Rollup changes
This commit is contained in:
52
rollup.config.js
Normal file
52
rollup.config.js
Normal file
@@ -0,0 +1,52 @@
|
||||
import resolve from "@rollup/plugin-node-resolve";
|
||||
import commonjs from "@rollup/plugin-commonjs";
|
||||
import babel from "@rollup/plugin-babel";
|
||||
import { terser } from "rollup-plugin-terser";
|
||||
import json from '@rollup/plugin-json';
|
||||
|
||||
const commonConfig = {
|
||||
input: 'src/index.js',
|
||||
output: {
|
||||
name: 'repertory-js',
|
||||
sourcemap: true
|
||||
},
|
||||
plugins: [
|
||||
resolve({
|
||||
customResolveOptions: {
|
||||
moduleDirectory: 'node_modules'
|
||||
}
|
||||
}),
|
||||
babel({
|
||||
exclude: 'node_modules/**',
|
||||
babelHelpers: 'runtime'
|
||||
}),
|
||||
commonjs(),
|
||||
json()
|
||||
]
|
||||
};
|
||||
|
||||
// ESM config
|
||||
const esmConfig = Object.assign({}, commonConfig);
|
||||
esmConfig.output = Object.assign({}, commonConfig.output, {
|
||||
file: 'dist/mjs/repertory-js.mjs',
|
||||
format: 'esm'
|
||||
});
|
||||
|
||||
// ESM prod config
|
||||
const esmProdConfig = Object.assign({}, esmConfig);
|
||||
esmProdConfig.output = Object.assign({}, esmConfig.output, {
|
||||
file: 'dist/mjs/repertory-js.min.mjs',
|
||||
sourcemap: false
|
||||
});
|
||||
esmProdConfig.plugins = [
|
||||
...esmConfig.plugins,
|
||||
terser()
|
||||
];
|
||||
|
||||
let configurations = [];
|
||||
configurations.push(
|
||||
esmConfig,
|
||||
esmProdConfig
|
||||
)
|
||||
|
||||
export default configurations;
|
||||
Reference in New Issue
Block a user