-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
52 lines (50 loc) · 1.57 KB
/
rollup.config.js
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
42
43
44
45
46
47
48
49
50
51
52
import terser from '@rollup/plugin-terser';
import babel from '@rollup/plugin-babel';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import postcss from 'rollup-plugin-postcss';
import autoprefixer from 'autoprefixer';
import svg from 'rollup-plugin-svg';
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,
},
plugins: [
svg(),
resolve(),
commonjs({
exclude: 'src/**',
}),
babel({
babelHelpers: 'bundled',
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: ['transform-react-remove-prop-types'],
}),
postcss({
plugins: [autoprefixer],
extract: true,
minimize: true,
sourceMap: true,
}),
terser({
ecma: 2020,
mangle: { toplevel: true },
compress: {
module: true,
toplevel: true,
unsafe_arrows: true,
drop_console: !devMode,
drop_debugger: !devMode
},
output: { quote_style: 1 }
})
],
external: ['react', 'react-dom'],
}
]