2 ms·
> the bundler has more structural information about the code it's working with For CommonJS modules this is only true to a very limited extent as the export bi
by jahewson 10y ago
> the bundler has more structural information about the code it's working with
For CommonJS modules this is only true to a very limited extent as the export binding process can run arbitrary code which can't be analysed (it's Turing complete).
ES6 modules on the other hand are static and can be extensively analysed without difficulty. This makes, for example tree-shaking pretty easy. Rollup is an ES6 module builder which is doing this already. The future's bright.