1.0.8 • Published 7 years ago
rollup-make-bundles v1.0.8
rollup-make-bundles
Make bundles with their own config merged with base config.
Install
npm i rollup-make-bundles --save
Usage
const rollupMakeBundles = require('rollup-make-bundles');
const baseConfig = {
entry: './src/index.js',
plugins: [
require('rollup-plugin-json')(),
require('rollup-plugin-buble')()
],
banner: `/*! hello world */`, // or Object
eslint: true // default: false
};
const bundlesConfig = {
ESModule: {
dest: 'dist/hello.es.js',
format: 'es'
},
CommonJS: {
dest: 'dist/hello.common.js',
format: 'cjs'
},
development: {
dest: 'dist/hello.js',
format: 'umd'
},
production: {
dest: 'dist/hello.min.js',
format: 'umd',
plugins: [
require('rollup-plugin-uglify')({
output: {
comments: (node, comment) => {
return comment.type == "comment2" && /^!/i.test(comment.value);
}
}
})
]
}
};
rollupMakeBundles(baseConfig, bundlesConfig)
.then(message => console.log(message))
.catch(err => console.log(err));
// or
rollupMakeBundles.easy({
entry: 'src/index.js',
presetPlugins: true
}, {
dest: 'dist',
name: 'hello'
});