Created
April 27, 2018 10:00
-
-
Save emmiep/6ddce28294d8efe934efecb93e691ae4 to your computer and use it in GitHub Desktop.
Create one bundle per script with Rollup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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