Skip to content

Instantly share code, notes, and snippets.

@gka
Last active September 29, 2017 22:43
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save gka/323cc675157ad5093eb104efd1ac54f7 to your computer and use it in GitHub Desktop.
rollup-pipe (with commonjs)
#!/usr/bin/env node
const rollup = require('rollup');
const commonjs = require('rollup-plugin-commonjs');
const inputOptions = {
input: process.argv[2],
plugins: [commonjs()],
onwarn: () => {}
};
rollup.rollup(inputOptions)
.then( (bundle) => {
bundle.generate({ format: 'cjs' }).then((res) => {
console.log(res.code);
});
});

this script converts whatever runs on node8 to something that runs on node6.

I use it if I just want to run something on node quickly for testing without having to create a whole rollup.config.js setup every time.

rollup-pipe future-es6-script.js | node`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment