Skip to content

Instantly share code, notes, and snippets.

@emmiep
Created April 27, 2018 10:00
Show Gist options
  • Save emmiep/6ddce28294d8efe934efecb93e691ae4 to your computer and use it in GitHub Desktop.
Save emmiep/6ddce28294d8efe934efecb93e691ae4 to your computer and use it in GitHub Desktop.
Create one bundle per script with Rollup
const FS = require('fs');
const Path = require('path');
const paths = {
src: 'src',
build: 'build'
};
const files = FS.readdirSync(paths.src)
.map((name) => Path.resolve(paths.src, name))
.map((path) => Object.assign({path}, Path.parse(path)))
.filter(({ext}) => ext === '.js');
export default files.map(({path, name, base}) => ({
input: path,
output: {
file: Path.join('build', base),
format: 'umd',
name
}
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment