2018-06-13T13:53:55Z||2018-06-13T13:53:55Z
适用于 rollup 0.60.4
需要安装的devDependencies:
rollup
rollup-plugin-commonjs
rollup-plugin-node-resolve
rollup-plugin-babel
babel-plugin-external-helpers
babel-preset-env
rollup.config.js
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import babel from 'rollup-plugin-babel';
export default {
input: 'index.js',
output: {
file: 'dist/main.js',
format: 'cjs',
},
plugins: [
resolve({
module: true,
}),
commonjs(),
babel({
exclude: 'node_modules/**'
}),
],
};
.babelrc
:
{
"presets": [
[
"env",
{
"modules": false
}
]
],
"plugins": [
"external-helpers"
]
}