-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrollup.config.js
More file actions
65 lines (63 loc) · 1.46 KB
/
rollup.config.js
File metadata and controls
65 lines (63 loc) · 1.46 KB
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
import babel from '@rollup/plugin-babel';
import resolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import externals from '../../configs/rollup/externals';
import * as outputs from '../../configs/rollup/outputs';
import * as plugins from '../../configs/rollup/plugins';
import pkg from './package.json';
const config = {
input: 'src/index.js',
output: {
intro: [
// Minification feature, mangles global properties
// ex: Promise.all(...) => $.all(...)
`const global = globalThis;`,
`const { Promise, Array, Map, Set, Object, Error, document } = global;`
].join('\n')
}
};
export default [{
...config,
external: externals(pkg),
output: [{
...outputs.commonjs,
...config.output,
file: 'lib/index.cjs.js'
}, {
...outputs.esm,
...config.output,
file: 'lib/index.esm.js'
}],
plugins: [
resolve(plugins.resolve),
babel({
...plugins.babel,
envName: 'client'
})
]
}, {
...config,
output: {
...outputs.iife,
...config.output,
name: 'radpack',
file: 'lib/browser.js'
},
plugins: [
resolve(plugins.resolve),
babel({
...plugins.babel,
envName: 'browser'
}),
terser({
...plugins.terser,
mangle: {
properties: {
// Minification feature, mangles properties that start with _
// ex: this._setCache(...) => this.$(...)
regex: /^_/
}
}
})
]
}];