calvinmetcalf / rollup-plugin-node-builtins

138 stars 40 forks source link

Consider not self-hosting modules #43

Open mattdesl opened 6 years ago

mattdesl commented 6 years ago

It seems this plugin is the go-to way of supporting Node.js builtins in rollup (like util), however it is really outdated and will always lag behind browserify builtins since it self-hosts all the modules.

It would be better if there was some way to install & depend on all modules, like util, and transpile them to ES6 as a pre-publish step. This module would still need to be built & updated manually every time any of the dependencies change, but something like greenkeeper could potentially help here.

Example: browserify's util has been continually updated over the last few months to keep parity with latest Node.js changes (promisify etc), whereas this module (and thus rollup devs) are stuck on a version from 2016.

calvinmetcalf commented 6 years ago

if you have any ideas on how to transpile them to ES6 I'm open to suggestions

mattdesl commented 6 years ago

Hmm was it all done manually?

I’ll think about it! Something I’m toying with is the idea of a new plugin that somehow merges rollup + browserify (a little differently than rollupify). The end result may be a little less optimized / tree shakeable than pure es6, but it has some other benefits like more robust handling of node code, builtins, and will not lag behind Node.js core updates as quickly. The two plugins could co exist to give users the choice between bundle size & robustness.

calvinmetcalf commented 6 years ago

yes, these were all artisanal hand ported by me originally and while some of them could probably be very easily changed, others are going to be a lot more difficult due to:

calvinmetcalf commented 6 years ago

one tricky thing is that util is one that gains a lot from being able to tree shake it out because it has a bunch of random things in it, which is also one that updates very frequently

bionicles commented 5 years ago

babel?