-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
104 lines (102 loc) · 2.3 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import { babel } from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import typescript from 'rollup-plugin-typescript2';
import pkg from './package.json';
const name = 'newtClient';
export default [
// cjs
{
input: './src/index.ts',
output: [
{
file: `./dist/cjs/${name}.js`,
sourcemap: 'inline',
format: 'cjs',
},
],
external: [...Object.keys(pkg.dependencies || {})],
plugins: [
typescript({ useTsconfigDeclarationDir: true }),
babel({
babelHelpers: 'bundled',
extensions: ['.ts', '.js'],
presets: [['@babel/preset-env', { targets: { node: '16' } }]],
}),
terser(),
],
},
// esm
{
input: './src/index.ts',
output: [
{
file: `./dist/esm/${name}.js`,
sourcemap: 'inline',
format: 'esm',
},
],
external: [...Object.keys(pkg.dependencies || {})],
plugins: [
typescript({
tsconfigOverride: { compilerOptions: { declaration: false } },
}),
babel({
babelHelpers: 'bundled',
extensions: ['.ts', '.js'],
presets: [
[
'@babel/preset-env',
{
targets: {
edge: '90',
firefox: '90',
chrome: '90',
safari: '13',
node: '14',
},
},
],
],
}),
terser(),
],
},
// umd
{
input: './src/index.ts',
output: [
{
name: name,
file: `./dist/umd/${name}.js`,
format: 'umd',
},
],
plugins: [
nodeResolve({ browser: true }),
typescript({
tsconfigOverride: { compilerOptions: { declaration: false } },
}),
commonjs({ extensions: ['.ts', '.js'] }),
babel({
babelHelpers: 'bundled',
extensions: ['.ts', '.js'],
presets: [
[
'@babel/preset-env',
{
targets: {
edge: '90',
firefox: '90',
chrome: '90',
safari: '13',
},
},
],
],
}),
terser(),
],
},
];