-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
46 lines (44 loc) · 1.02 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
import postcss from 'rollup-plugin-postcss'
import replace from '@rollup/plugin-replace'
import svg from 'rollup-plugin-svg'
import cjs from '@rollup/plugin-commonjs'
import node from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import path from 'path'
const dev = process.env.NODE_ENV !== 'production'
export default {
input: 'src/scripts/main.js',
output: {
sourcemap: false,
format: 'iife',
name: 'main',
file: 'dist/assets/main.bundle.js',
},
plugins: [
replace({
DEV_MODE: dev,
preventAssignment: true,
}),
svg(),
postcss({
extract: path.resolve('dist/assets/main.bundle.css'),
minimize: !dev,
}),
node(),
cjs(),
!dev && terser(),
],
watch: {
clearScreen: false,
},
onwarn: function (warning, superOnWarn) {
/*
* skip certain warnings
* https://github.com/openlayers/openlayers/issues/10245
*/
if (warning.code === 'THIS_IS_UNDEFINED') {
return
}
superOnWarn(warning)
},
}