nolanlawson / rollupify

Browserify transform to apply Rollup (UNMAINTAINED)
Apache License 2.0
386 stars 16 forks source link

Doesn't work with rollup-plugin-commonjs #55

Closed stevenvachon closed 6 years ago

stevenvachon commented 7 years ago

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.

nolanlawson commented 7 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! :)

stevenvachon commented 7 years ago

But I don't want a config file for one plugin.

stevenvachon commented 7 years ago

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") )
nolanlawson commented 7 years ago

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? :)

nolanlawson commented 6 years ago

closing stale issues