Closed gauntface closed 7 years ago
Do you have some example code or perhaps a small project to reproduce?
Note that rollup-plugin-babel
runs on each individual module before the code is bundled, so even if rollup adds an iife around the output, it won't yet be there when babili runs.
I don't have a small example, but this is a result of workbox: https://github.com/GoogleChrome/workbox/
It's likely that Rollup is our issue by the sound of it. Would it be insane to use Rollup for bundling and module format and then use babel to minify in a seperate step?
Would it be insane to use Rollup for bundling and module format and then use babel to minify in a seperate step?
Not at all!
Short answer:
babel-loader
vs babili-webpack-plugin
when webpack is the bundler.Long answer:
transform
and transformBundle
(Ref)transform
(source) - So Babel first. The babili preset will receive all the code in a file as toplevel and minify the file.transformBundle
(source). So Rollup first and babili happens next on the entire bundle.Thanks for the extra info @boopathi. I did try running with an option that looked like it would mangle top level classes and functions, but that didn't seem to take affect but by the sounds of it, if it works, it would be preferable in rollup-plugin-babel (i.e. using transform)
Are you facing any issues with
{
presets: [
[
"babili",
{
mangle: { topLevel: true }
}
]
]
}
I'm using Babili with Rollup and at the moment babili is removing comments and its mangling variable names, but class names are remaining untouched, not sure why. Everything I can see / have tried, this should either work out the box.
The resulting code is in an iife, so I don't think there is any issue with global scope and renaming. Does anyone have any ideas / tips?