You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As browsers are starting to implement module loaders, I've been looking at how well Babili can compress ES modules, and the short answer atm seems to be 'not very well'. AFAICS there's 2 main reasons for this.
it's not mangling top-level names, which it should be able to do within modules, which have their own scope. I see a topLevel option was recently added to minify-mangle-names, but it looks like this was after the latest version was released. So, question: how do I install the latest master specifically for this plugin so I can try it out without waiting for the next release? It looks like it's not as simple as copying the current master source into node_modules.
it's not mangling imported/exported names. Default imports and exports can surely be mangled without problem, so import importedName from ... can become import mm from ..., and export default exportedNameexport default mm. Similarly, for named imports, I'm thinking that import {importedName} from ... could become import {importedName as mm} ..., and named exports likewise. I've looked through issues/PRs and couldn't find any discussion of this, so I'm assuming this is not done atm because no-one's got around to it yet. Or is there some other issue?
I've just got around to installing the latest version, which includes the topLevel option. This fixes item 1 as expected, but it looks like it also fixes the mangling of default import/export, which it presumably also treats as topLevel. So it looks like I have to revise my original comment to: 'it's doing a pretty good job of compressing ES modules if you set topLevel:true'. :-)
Activity
boopathi commentedon Jan 30, 2017
There is https://github.com/babel/babili/blob/master/CONTRIBUTING.md on how to build babili. You can simply then
npm linkand use it.Yes. This still needs to be implemented.
probins commentedon Feb 16, 2017
I've just got around to installing the latest version, which includes the
topLeveloption. This fixes item 1 as expected, but it looks like it also fixes the mangling of default import/export, which it presumably also treats as topLevel. So it looks like I have to revise my original comment to: 'it's doing a pretty good job of compressing ES modules if you set topLevel:true'. :-)