forked from chartist-js/chartist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
65 lines (63 loc) · 1.33 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
import swc from 'rollup-plugin-swc';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import pkg from './package.json';
const extensions = ['.js', '.ts', '.tsx'];
const external = _ => /node_modules/.test(_) && !/@swc\/helpers/.test(_);
const plugins = (targets, minify) =>
[
nodeResolve({
extensions
}),
swc({
jsc: {
parser: {
syntax: 'typescript'
},
externalHelpers: true
},
env: {
targets
},
module: {
type: 'es6'
},
sourceMaps: true
}),
minify && terser()
].filter(Boolean);
export default [
{
input: pkg.main,
plugins: plugins('defaults, not ie 11, not ie_mob 11'),
external,
output: {
file: pkg.publishConfig.main,
format: 'cjs',
exports: 'named',
sourcemap: true
}
},
{
input: pkg.main,
plugins: plugins('defaults, not ie 11, not ie_mob 11', true),
external: () => false,
output: {
file: pkg.unpkg,
format: 'umd',
name: 'Chartist',
exports: 'named',
sourcemap: true
}
},
{
input: pkg.main,
plugins: plugins('defaults and supports es6-module'),
external,
output: {
file: pkg.publishConfig.module,
format: 'es',
sourcemap: true
}
}
];