-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathrollup.config.mjs
61 lines (57 loc) · 1.13 KB
/
rollup.config.mjs
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
import resolve from '@rollup/plugin-node-resolve'
import postcss from 'rollup-plugin-postcss'
import { terser } from 'rollup-plugin-terser'
import compiler from '@ampproject/rollup-plugin-closure-compiler'
import { default as importHTTP } from 'import-http/rollup.js'
import babel from '@rollup/plugin-babel'
const dev = {
input: 'app/js/index.js',
output: {
file: 'app/bundle.js',
format: 'esm',
sourcemap: 'inline',
},
plugins: [
resolve(),
importHTTP(),
postcss({
inject: false,
}),
babel({
exclude: 'node_modules/**',
"presets": [
["@babel/env"]
]
}),
],
watch: {
exclude: ['node_modules/**'],
}
}
const prod = {
input: 'app/js/index.js',
output: {
file: 'dist/bundle.js',
format: 'esm',
sourcemap: true,
},
plugins: [
resolve(),
importHTTP(),
postcss({
extract: true,
minimize: { preset: 'default' },
}),
babel({
exclude: 'node_modules/**',
"presets": [
["@babel/env"]
]
}),
compiler(),
terser(),
]
}
export default process.env.NODE_ENV === 'production'
? prod
: dev