import { foo, bar } as obj from 'module

Tiddo Langerak tiddolangerak at gmail.com
Tue Dec 12 08:19:14 UTC 2017


Thanks for pointing that out, I didn't know that (I should've tested my 
assumptions). It seems that Webpack does the same.

The entire motivation behind selective namespaced imports relied on that 
assumption, so if treeshaking works with * imports then I don't think 
there's much use for this feature.

On 12/12/2017 09:51 AM, Ltrlg wrote:
> 2017-12-12 8:39 GMT+01:00 Tiddo Langerak <tiddolangerak at gmail.com 
> <mailto:tiddolangerak at gmail.com>>:
>
>     - Star imports prevent treeshaking.
>
>
> Treeshaking does work with star imports as long as you only have 
> statically known usages. At least Rollup handles these situations as 
> if it was a named import [1]
>
> [1]: 
> https://rollupjs.org/repl?version=0.52.1&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMColMjBhcyUyMG1hdGglMjBmcm9tJTIwJy4lMkZtYXRocy5qcyclM0IlNUNuY29uc29sZS5sb2coJTIwbWF0aC5jdWJlKCUyMDUlMjApJTIwKSUzQiUyMCUyRiUyRiUyMDEyNSUyMiU3RCUyQyU3QiUyMm5hbWUlMjIlM0ElMjJtYXRocy5qcyUyMiUyQyUyMmNvZGUlMjIlM0ElMjJleHBvcnQlMjBmdW5jdGlvbiUyMHNxdWFyZSUyMCglMjB4JTIwKSUyMCU3QiU1Q24lNUN0cmV0dXJuJTIweCUyMColMjB4JTNCJTVDbiU3RCU1Q24lNUNuZXhwb3J0JTIwZnVuY3Rpb24lMjBjdWJlJTIwKCUyMHglMjApJTIwJTdCJTVDbiU1Q3RyZXR1cm4lMjB4JTIwKiUyMHglMjAqJTIweCUzQiU1Q24lN0QlMjIlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyY2pzJTIyJTJDJTIyZ2xvYmFscyUyMiUzQSU3QiU3RCUyQyUyMm5hbWUlMjIlM0ElMjJteUJ1bmRsZSUyMiUyQyUyMmFtZCUyMiUzQSU3QiUyMmlkJTIyJTNBJTIyJTIyJTdEJTdEJTJDJTIyZXhhbXBsZSUyMiUzQW51bGwlN0Q=
>
> Ltrlg




More information about the es-discuss mailing list