Skip to content

Instantly share code, notes, and snippets.

@gka gka/rollup-pipe.js
Last active Sep 29, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.