-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathrollup.config.js
54 lines (51 loc) · 1.22 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
48
49
50
51
52
53
54
import resolve from '@rollup/plugin-node-resolve';
import json from '@rollup/plugin-json';
import serve from 'rollup-plugin-serve';
import commonjs from '@rollup/plugin-commonjs';
import terser from '@rollup/plugin-terser';
const dev = process.env.ROLLUP_WATCH || process.env.DEV;
const serveopts = {
contentBase: ['dist'],
host: '0.0.0.0',
port: 5050,
open: true,
allowCrossOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
};
export default {
input: 'src/main.js',
output: {
file: 'dist/swiss-army-knife-card.js',
format: 'es',
name: 'SwissArmyKnifeCard',
sourcemap: !!dev,
},
onwarn(warning, warn) {
// See: https://github.com/reduxjs/redux-toolkit/issues/1466
// Skip certain warnings
// should intercept ... but doesn't in some rollup versions
if (warning.code === 'THIS_IS_UNDEFINED') { return; }
// console.warn everything else
warn(warning);
},
watch: {
exclude: 'node_modules/**',
},
plugins: [
commonjs(),
// json({
// include: 'package.json',
// preferConst: true,
// }),
json(),
resolve(),
dev && serve(serveopts),
!dev && terser({
mangle: {
safari10: true,
},
}),
],
};