mirror of
https://github.com/tenrok/BBob.git
synced 2026-05-15 11:59:37 +03:00
aac1ae0e81
Updated Rollup Updated Babel Fixed security problems with some dependencies
56 lines
1.1 KiB
JavaScript
56 lines
1.1 KiB
JavaScript
import resolve from '@rollup/plugin-node-resolve';
|
|
import babel from 'rollup-plugin-babel';
|
|
import replace from '@rollup/plugin-replace';
|
|
import commonjs from '@rollup/plugin-commonjs';
|
|
import { terser } from 'rollup-plugin-terser';
|
|
|
|
const pkg = require(`${process.cwd()}/package.json`);
|
|
const { NODE_ENV } = process.env;
|
|
|
|
const baseConfig = {
|
|
input: 'src/index.js',
|
|
external: ['react', 'vue'],
|
|
output: {
|
|
file: pkg.browser,
|
|
format: 'umd',
|
|
name: pkg.browserName,
|
|
globals: {
|
|
react: 'React',
|
|
vue: 'Vue',
|
|
},
|
|
},
|
|
plugins: [
|
|
resolve(),
|
|
babel({
|
|
exclude: '**/node_modules/**',
|
|
}),
|
|
replace({
|
|
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
|
|
}),
|
|
commonjs(),
|
|
],
|
|
};
|
|
|
|
// only for dist
|
|
export default [
|
|
baseConfig,
|
|
{
|
|
...baseConfig,
|
|
output: {
|
|
...baseConfig.output,
|
|
file: pkg.browser.replace('.js', '.min.js'),
|
|
},
|
|
plugins: [
|
|
...baseConfig.plugins,
|
|
terser({
|
|
compress: {
|
|
pure_getters: true,
|
|
unsafe: true,
|
|
unsafe_comps: true,
|
|
warnings: false,
|
|
},
|
|
}),
|
|
],
|
|
},
|
|
];
|