|
|
|
|
|
by azemetre
1418 days ago
|
|
There's a lot of "gotchas" when it comes to tree shaking in the JS ecosystem (not using the correct export style, having to do commonjs vs esm, what browser target you want like es3 vs es5 vs es2018 vs esnext), it also depends on the libraries you are pulling and if they're following practices to minimize outputs as well. This is a decent article that discusses the basic strategies: https://www.smashingmagazine.com/2021/05/tree-shaking-refere... But basically tree shaking and dead code elimination can only be effective as the code you write. If you make it hard to parse with ASTs, it's going to hard to tree shake. |
|