-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
56 lines (55 loc) · 1.25 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
55
56
import { rollupPluginHTML as html } from '@web/rollup-plugin-html'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import replace from '@rollup/plugin-replace'
import terser from '@rollup/plugin-terser'
import copy from 'rollup-plugin-copy'
import { generateSW } from 'rollup-plugin-workbox'
export default {
input: 'src/index.html',
output: {
dir: 'dist',
},
plugins: [
html({ extractAssets: false }),
nodeResolve(),
replace({
preventAssignment: true,
values: {
'process.env.NODE_ENV': JSON.stringify('production'),
},
}),
copy({
copyOnce: true,
targets: [
{
src: 'src/css',
dest: 'dist',
},
{
src: 'assets',
dest: 'dist',
},
{
src: 'assets/favicon/favicon.ico',
dest: 'dist',
},
],
}),
generateSW({
swDest: 'dist/sw.js',
globDirectory: 'dist/',
globPatterns: [
'**/*.{js,css,html,svg}',
'assets/audio/*',
'assets/fonts/*',
],
dontCacheBustURLsMatching: /inline-module-.*\.js/,
navigateFallback: '/index.html',
skipWaiting: true,
}),
terser({
ecma: '2016',
// keep_fnames: true,
}),
],
}