Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Commit acce924

Browse files
committed
build: update rollup config
1 parent 345b74e commit acce924

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

rollup.config.js

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import replace from 'rollup-plugin-replace'
44

55
import pkg from './package.json'
66

7-
const defaultConfig = Object.freeze({
7+
const defaultConfig = {
88
input: 'lib/index.js',
99
external: ['react', 'react-dom', 'prop-types'],
1010
plugins: [
@@ -16,40 +16,35 @@ const defaultConfig = Object.freeze({
1616
}),
1717
terser()
1818
]
19-
})
20-
21-
const createConfig = mutator => {
22-
const config = { ...defaultConfig }
23-
return mutator(config)
2419
}
2520

21+
const createConfig = (config) => ({
22+
...defaultConfig,
23+
...config
24+
})
25+
2626
export default [
27-
createConfig(config => {
28-
config.output = {
27+
createConfig({
28+
output: {
2929
file: 'dist/' + pkg.module,
3030
format: 'esm'
3131
}
32-
return config
3332
}),
34-
createConfig(config => {
35-
config.output = {
33+
createConfig({
34+
output: {
3635
file: 'dist/' + pkg.main,
3736
format: 'cjs'
3837
}
39-
return config
4038
}),
41-
createConfig(config => {
42-
config.experimentalCodeSplitting = true
43-
config.optimizeChunks = true
44-
config.input = [
39+
createConfig({
40+
input: [
4541
'./lib/List',
4642
'./lib/Show',
4743
'./lib/Switch'
48-
]
49-
config.output = {
44+
],
45+
output: {
5046
dir: 'dist',
5147
format: 'cjs'
5248
}
53-
return config
5449
})
5550
]

0 commit comments

Comments
 (0)