-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
41 lines (39 loc) · 1023 Bytes
/
rollup.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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';
const devMode = (process.env.NODE_ENV === 'development');
console.log(`${devMode ? 'development' : 'production'} mode bundle`);
export default {
input: 'src/index.js',
output: {
file: 'dist/index.js',
format: 'es',
sourcemap: devMode ? 'inline' : false,
},
external: ['react', 'react-dom'],
plugins: [
resolve(),
commonjs({
include: 'node_modules/**',
transformMixedEsModules: true,
}),
babel({
babelHelpers: 'bundled',
presets: ['@babel/preset-react'],
exclude: 'node_modules/**'
}),
terser({
ecma: 2020,
mangle: { toplevel: true },
compress: {
module: true,
toplevel: true,
unsafe_arrows: true,
drop_console: !devMode,
drop_debugger: !devMode,
},
output: { quote_style: 1 }
})
]
};