-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
rollup.config.js
53 lines (51 loc) · 1.05 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
import { swc } from 'rollup-plugin-swc3';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import del from 'rollup-plugin-delete';
import pkg from './package.json' assert { type: 'json' };
const extensions = ['.js', '.ts', '.tsx'];
const external = (_) => /node_modules/.test(_) && !/@swc\/helpers/.test(_);
const plugins = (targets) => [
del({ targets: 'dist/*' }),
nodeResolve({
extensions
}),
swc({
tsconfig: false,
jsc: {
parser: {
syntax: 'typescript',
tsx: true
},
transform: {
react: {
useBuiltins: true
}
},
externalHelpers: true
},
env: {
targets
},
module: {
type: 'es6'
},
sourceMaps: true
})
];
export default {
input: pkg.exports,
plugins: plugins('defaults and supports es6-module'),
external,
output: [
{
file: pkg.publishConfig.exports.import,
format: 'es',
sourcemap: true
},
{
file: pkg.publishConfig.exports.require,
format: 'cjs',
sourcemap: true
}
]
};