-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrollup.config.js
47 lines (42 loc) · 1.06 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
import buble from 'rollup-plugin-buble'
import json from 'rollup-plugin-json'
import commonjs from 'rollup-plugin-commonjs'
import nodeResolve from 'rollup-plugin-node-resolve'
import replace from 'rollup-plugin-replace'
import uglify from 'rollup-plugin-uglify'
import css from '@henrikjoreteg/rollup-plugin-css'
const IS_PROD = process.env.NODE_ENV === 'production'
const baseConfig = {
plugins: [
css({
output: './public/build/s.css',
minify: IS_PROD
}),
json(),
buble({ jsx: 'h' }),
nodeResolve({ jsnext: true, main: true }),
commonjs(),
replace({ 'process.env.NODE_ENV': JSON.stringify('production') })
]
}
if (IS_PROD) {
baseConfig.plugins.push(uglify())
}
const getConfig = opts => Object.assign({}, baseConfig, opts)
const hasNoFileExtension = /^(?!.*\.\w{1,7}$)/
export default [
getConfig({
input: 'src/worker',
output: {
format: 'umd',
file: 'public/build/worker.js'
}
}),
getConfig({
input: 'src/main',
output: {
format: 'umd',
file: 'public/build/main.js'
}
})
]