2 ms·
I've been reading about tree shaking. I'm not at my laptop at the moment, so I can't settle this question by testing it. I'll toss it to the community: https:/
by sillysaurus3 11y ago
I've been reading about tree shaking. I'm not at my laptop at the moment, so I can't settle this question by testing it. I'll toss it to the community:
https://news.ycombinator.com/item?id=11349606 https://news.ycombinator.com/item?id=11349606
Basically, how does tree shaking deal with dynamic inclusions? Are dynamic inclusions simply not allowed? But in that case, what about eval? Is eval just not allowed to import anything?
I've been reading posts like these, but they are pretty unsatisfying regarding technical detail: https://medium.com/@Rich_Harris/tree-shaking-versus-dead-code-elimination-d3765df85c80 https://medium.com/@Rich_Harris/tree-shaking-versus-dead-cod...
Maybe someone else was wondering the same thing, so I decided to post it here before wandering off to the ES6 spec to figure it out.
- lewisl9029 11y ago> Are dynamic inclusions simply not allowed? Correct. One of the motivating factors for ES6 modules was to create a format that can be statically analyzed and optimized. > Is eval just not allowed to import anything? Correct. See this excellent writeup for more details regarding ES6 modules: http://www.2ality.com/2014/09/es6-modules-final.html http://www.2ality.com/2014/09/es6-modules-final.html