-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
74 lines (71 loc) · 2.22 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
import resolve from '@rollup/plugin-node-resolve'
import babel from '@rollup/plugin-babel'
import commonjs from '@rollup/plugin-commonjs'
// import { terser } from 'rollup-plugin-terser'
import typescript from 'rollup-plugin-typescript2'
import { visualizer } from 'rollup-plugin-visualizer'
import pkg from './package.json'
const config = require('./config')
// const production = !process.env.ROLLUP_WATCH
export default [
{
input: 'src/index.ts',
output: [
{
file: pkg.main,
exports: 'auto',
format: 'cjs',
banner: config.banner
},
{
file: 'lib/index.esm.js',
exports: 'auto',
format: 'es',
banner: config.banner
}
],
plugins: [
resolve({
// Use the `package.json` "browser" field
browser: true,
// Resolve .mjs and .js files
extensions: ['.mjs', '.js'],
// Prefer node.js built-ins instead of npm packages
preferBuiltins: true
}),
commonjs({
sourceMap: false
}),
typescript({
tsconfigOverride: {
compilerOptions: {
declaration: false,
target: 'es6'
},
include: ['src/**/*.ts'],
exclude: [
'node_modules',
'__tests__',
'core-js',
'js-cool',
'axios'
]
},
abortOnError: false
}),
babel({
babelHelpers: 'bundled',
extensions: config.extensions,
exclude: [/\/core-js\//, 'node_modules/**'],
// runtimeHelpers: true,
sourceMaps: true
}),
visualizer()
],
external(id) {
return ['core-js', 'axios', 'js-cool', 'regenerator-runtime'].some(
k => new RegExp('^' + k).test(id)
)
}
}
]