-
Notifications
You must be signed in to change notification settings - Fork 938
Expand file tree
/
Copy pathrollup.config.js
More file actions
30 lines (26 loc) · 838 Bytes
/
rollup.config.js
File metadata and controls
30 lines (26 loc) · 838 Bytes
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
const commonjs = require('@rollup/plugin-commonjs')
const {babel} = require('@rollup/plugin-babel')
const config = require('kcd-scripts/dist/config/rollup.config')
const babelPlugin = babel({
babelHelpers: 'runtime',
extensions: ['.js', '.jsx', '.ts', '.tsx'],
exclude: '**/node_modules/**',
})
const cjsPlugin = commonjs({include: 'node_modules/**'})
config.plugins = [
babelPlugin,
cjsPlugin,
...config.plugins.filter(
p => !['babel', 'typescript', 'commonjs'].includes(p.name),
),
]
const prevExternal = config.external
config.external = id => {
if (id.includes('productionEnum.macro') || id.includes('is.macro')) {
return true
}
if (typeof prevExternal === 'function') return prevExternal(id)
if (Array.isArray(prevExternal)) return prevExternal.includes(id)
return false
}
module.exports = config