-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
53 lines (51 loc) · 1.07 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 nodeEsm from '@trigen/browserslist-config/node-esm'
import node from '@trigen/browserslist-config/node'
import pkg from './package.json' assert { type: 'json' }
const extensions = ['.js', '.ts']
const external = _ => /node_modules/.test(_) && !/@swc\/helpers/.test(_)
const plugins = targets => [
nodeResolve({
extensions
}),
swc({
tsconfig: false,
jsc: {
parser: {
syntax: 'typescript',
tsx: true
},
externalHelpers: true
},
env: {
targets
},
module: {
type: 'es6'
},
sourceMaps: true
})
]
export default [
{
input: pkg.exports,
plugins: plugins(nodeEsm.join(', ')),
external,
output: {
file: pkg.publishConfig.exports.import,
format: 'es',
sourcemap: true
}
},
{
input: pkg.exports,
plugins: plugins(node.join(', ')),
external,
output: {
file: pkg.publishConfig.exports.require,
format: 'cjs',
sourcemap: true
}
}
]