This repository has been archived by the owner on Oct 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrollup.config.js
75 lines (71 loc) · 1.47 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
64
65
66
67
68
69
70
71
72
73
74
75
import { DEFAULT_EXTENSIONS } from '@babel/core';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import buble from 'rollup-plugin-buble';
import babel from 'rollup-plugin-babel';
import { terser } from 'rollup-plugin-terser';
const plugins = [
nodeResolve({
mainFields: ['module', 'jsnext', 'main'],
browser: true
}),
commonjs({
include: /\/node_modules\//
}),
buble({
transforms: {
dangerousForOf: true,
dangerousTaggedTemplateString: true
},
objectAssign: 'Object.assign'
}),
babel({
babelrc: false,
extensions: [...DEFAULT_EXTENSIONS, 'ts', 'tsx'],
exclude: 'node_modules/**',
presets: [],
plugins: [['babel-plugin-closure-elimination', {}]]
}),
terser({
warnings: true,
ecma: 5,
ie8: false,
mangle: true,
toplevel: true,
keep_fnames: true,
compress: {
reduce_funcs: false,
passes: 4
},
output: {
beautify: true,
braces: true,
indent_level: 2
}
})
];
const config = {
input: './src/index.js',
external: () => false,
plugins,
treeshake: {
propertyReadSideEffects: false
},
output: [
{
legacy: true,
freeze: false,
esModule: false,
file: './dist/pessimism.js',
format: 'cjs'
},
{
legacy: true,
freeze: false,
esModule: false,
file: './dist/pessimism.es.js',
format: 'esm'
}
]
};
export default config;