Skip to content

Instantly share code, notes, and snippets.

@hiddenboox
Created December 16, 2016 14:49
Show Gist options
  • Save hiddenboox/fd7d54843b7f56cfa59f78d7a3b8d64b to your computer and use it in GitHub Desktop.
Save hiddenboox/fd7d54843b7f56cfa59f78d7a3b8d64b to your computer and use it in GitHub Desktop.
// move to main.js
define(['utils/array', 'react'], function (array, React) {
React.render();
});
// move to index.js
const rollup = require('rollup');
const amd = require('rollup-plugin-amd');
const fs = require('fs');
const writeES6Module = ({ modules: [module] }) => fs.writeFile('main.amd.js', module.code, function (err) {
if (err) return console.log(err);
});
rollup.rollup({
entry: 'main.js',
plugins: [
amd()
]
}).then(writeES6Module);
// then run "node index"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment