Closed stevenvachon closed 6 years ago
Rollup can optimize ES6 modules much more than CJS modules, e.g. it can do tree-shaking.
Rollup plugins are easiest to use if you avoid the CLI; if you're wondering how to do it for rollupify, I recommend looking at the tests which do this. Hope that helps! :)
But I don't want a config file for one plugin.
Also, you didn't answer my question regarding rollup-plugin-commonjs. This isn't doing anything to my require()
s:
const CJStoES2015 = require("rollup-plugin-commonjs")({ sourceMap:false/*, useStrict:false*/ });
browserify("./src/browser.js", { detectGlobals:false, standalone:"IsomorphicURL" })
.transform("rollupify", { global:true, plugins:[CJStoES2015] })
.transform("babelify", { global:true, presets:["es2015"] })
.transform("aliasify", { global:true, aliases:{ "tr46":"./src/tr46" }})
.bundle()
.pipe( createWriteStream("./lite/browser.js") )
If a rollup plugin isn't working correctly when you plug it into rollupify, then that's definitely a bug. Looking at your code I can't see what the problem is. Can you provide a test case to reproduce? And/or a PR? :)
closing stale issues
Wouldn't rollup-plugin-commonjs be preferable to cjs-to-es6? It fits into the rollup workflow and can be applied globally via browserify's
--transform-global
.Not sure of the status of such, as mentioned a while back in #20
I'm also having difficulty figuring out how to load rollup plugins via CLI.