-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
63 lines (61 loc) · 1.56 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
53
54
55
56
57
58
59
60
61
62
63
import { babel } from '@rollup/plugin-babel';
import replace from '@rollup/plugin-replace';
import terser from '@rollup/plugin-terser';
import nodeExternals from 'rollup-plugin-node-externals';
/** @type {import('rollup').RollupOptions} */
const config = {
input: './index.ts',
output: [
{
dir: 'lib/',
entryFileNames: '[name].cjs',
format: 'cjs',
sourcemap: true,
generatedCode: 'es2015',
freeze: false,
externalLiveBindings: false,
compact: true,
exports: 'named',
},
{
dir: 'lib/es',
entryFileNames: '[name].mjs',
format: 'es',
sourcemap: true,
generatedCode: 'es2015',
freeze: false,
externalLiveBindings: false,
compact: true,
exports: 'named',
},
],
treeshake: { moduleSideEffects: false, propertyReadSideEffects: false },
plugins: [
nodeExternals(),
babel({
babelrc: true,
babelHelpers: 'runtime',
extensions: ['.js', '.ts', '.tsx'],
exclude: [/\.test\.tsx?/i, /node_modules\//i],
}),
replace({
preventAssignment: false,
ENVIRONMENT: JSON.stringify('production'),
'process.env.NODE_ENV': JSON.stringify('production'),
}),
terser({
toplevel: true,
mangle: { properties: { regex: /^__/ } },
ecma: 2015,
compress: {
arguments: true,
booleans_as_integers: true,
hoist_funs: true,
passes: 3,
toplevel: true,
pure_funcs: ['console.info', 'console.debug', 'console.warn'],
},
}),
],
};
export default config;