-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.cjs
82 lines (78 loc) · 2.21 KB
/
rollup.config.cjs
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
/* eslint-disable @typescript-eslint/no-var-requires */
const { babel } = require('@rollup/plugin-babel');
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const typescript = require('@rollup/plugin-typescript');
const terser = require('@rollup/plugin-terser');
const { dts } = require('rollup-plugin-dts');
const packageJson = require('./package.json');
const config = [
{
input: 'src/index.ts',
output: [
{
file: 'dist/safeNumber.min.js',
format: 'iife',
name: 'SafeNumber',
sourcemap: true,
exports: 'default',
plugins: [terser()]
}
],
plugins: [
nodeResolve({
browser: true
}),
commonjs({
transformMixedEsModules: true
}),
typescript({
tsconfig: './tsconfig.json',
declaration: false,
module: 'esnext'
}),
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**',
presets: [
['@babel/preset-env', {
targets: '> 0.25%, not dead',
modules: false
}]
]
})
]
},
{
input: 'src/index.ts',
output: [
{
file: packageJson.main,
format: 'cjs',
sourcemap: true,
exports: 'default'
},
{
file: packageJson.module,
format: 'es',
sourcemap: true,
exports: 'default'
}
],
plugins: [
nodeResolve(),
commonjs(),
typescript({ tsconfig: './tsconfig.json' }),
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**'
})
]
},
{
input: 'dist/types/index.d.ts',
output: [{ file: 'dist/index.d.ts', format: 'es' }],
plugins: [dts()]
}
];
module.exports = config;