minify icon indicating copy to clipboard operation
minify copied to clipboard

Add option to ignore asm.js code

Open curiousdannii opened this issue 8 years ago • 6 comments

I'm wanting to minify a project which contains some Emscripten generated asm.js. As babili cannot safely minimise it and Emscripten already minimises the asm.js to a large extent, an option to ignore all code in an asm.js function would be very helpful.

Future work could selectively enable or disable transformations which are safe for asm.js, but for now a global switch would be great.

curiousdannii avatar Jun 22 '17 14:06 curiousdannii

Are you using babili with babel-loader? you can ignore the files from the webpack config in that case.

vigneshshanmugam avatar Jun 22 '17 15:06 vigneshshanmugam

No, I'm running it with the babili cli command. I also only want to ignore part of a file - the asm.js functions (with the pragma "use asm"). The rest should be minified.

curiousdannii avatar Jun 22 '17 15:06 curiousdannii

We are working on the new CLI for babili which can help with this https://github.com/babel/babili/pull/507/

Also, you can try with babel cli for now like this.

babel <src> --out-dir <lib> --ignore asm.js

vigneshshanmugam avatar Jun 22 '17 15:06 vigneshshanmugam

That will not help. I don't want to ignore a file, I want to ignore functions with the "use asm" pragma, as UglifyJS does.

curiousdannii avatar Jun 22 '17 16:06 curiousdannii

Does this also affect the babel-generator's output as well?

Though Babili is a list of transformations, babel-generator minify: true takes care of squashing some numbers to its minimized form. Not sure if this has changed either.

boopathi avatar Jun 22 '17 17:06 boopathi

Maybe Babel should stop doing everything except whitespace removal for minification, and leave all of the other optimizations to Babili.

j-f1 avatar Jun 22 '17 18:06 j-f1