forked from reactchartjs/react-chartjs-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
56 lines (54 loc) · 1.06 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
import swc from 'rollup-plugin-swc';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import pkg from './package.json';
const extensions = ['.js', '.ts', '.tsx'];
const external = _ => /node_modules/.test(_) && !/@swc\/helpers/.test(_);
const plugins = targets => [
nodeResolve({
extensions,
}),
swc({
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
transform: {
react: {
useBuiltins: true,
},
},
externalHelpers: true,
},
env: {
targets,
},
module: {
type: 'es6',
},
sourceMaps: true,
}),
];
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 and supports es6-module'),
external,
output: {
file: pkg.publishConfig.module,
format: 'es',
sourcemap: true,
},
},
];