-
Notifications
You must be signed in to change notification settings - Fork 1
/
bundle-rollup.js
62 lines (58 loc) · 1.43 KB
/
bundle-rollup.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
// @ts-check
const typescript = require('rollup-plugin-typescript2')
// based on @nrwl/react/plugins/bundle-rollup.js
Object.defineProperty(exports, '__esModule', { value: true })
function getRollupOptions(options) {
const extraGlobals = {
react: 'React',
'react-dom': 'ReactDOM',
'styled-components': 'styled',
'@emotion/react': 'emotionReact',
'@emotion/styled': 'emotionStyled',
}
if (Array.isArray(options.output)) {
options.output.forEach((o) => {
o.globals = Object.assign(Object.assign({}, o.globals), extraGlobals)
})
} else {
options.output = Object.assign(Object.assign({}, options.output), {
globals: Object.assign(
Object.assign({}, options.output.globals),
extraGlobals,
),
})
}
options.plugins = options.plugins
.map((p) => {
if (p !== 'rpt2') {
return p
}
if (options.output.format === 'esm') {
return typescript.default({
tsconfigOverride: {
compilerOptions: {
lib: ['es5', 'es6', 'dom'],
target: 'es2018',
declaration: true,
noEmitOnError: true,
},
},
})
} else {
return typescript.default({
tsconfigOverride: {
compilerOptions: {
lib: ['es5', 'es6', 'dom'],
target: 'es5',
declaration: true,
noEmitOnError: true,
},
},
})
}
})
.filter((p) => p.name !== 'babel')
return options
}
module.exports = getRollupOptions
//# sourceMappingURL=bundle-rollup.js.map