Comment by sillysaurus3
11 years 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://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.
> 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