-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
54 lines (49 loc) · 1.1 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
import common from '@rollup/plugin-commonjs'
import node from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'
import minize from 'rollup-plugin-minize'
const path = require('path')
const getPath = _path => path.resolve(__dirname, _path)
const input = path.join(__dirname, './src/index.ts')
const output = path.join(__dirname, './build/index')
const isPro = process.env.NODE_ENV === 'production'
console.log('isPro', isPro)
export default {
input,
plugins: ([
common(),
node(),
typescript({
tsconfig: getPath('./tsconfig.json')
})
]).concat(isPro
? [
minize({
sourceMap: true
})
]
: []
),
external: [/node_modules/],
output: [
{
name: 'module',
file: output + (isPro ? '.min.js' : '.js'),
format: 'umd',
sourcemap: true,
globals: {
tslib: 'tslib'
}
},
{
name: 'module',
file: output + (isPro ? '.cjs.min.js' : '.cjs.js'),
format: 'cjs',
exports: 'auto',
sourcemap: false,
globals: {
tslib: 'tslib'
}
}
]
}