-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
64 lines (61 loc) · 1.5 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
57
58
59
60
61
62
63
64
// Import rollup plugins
import {copy} from '@web/rollup-plugin-copy';
import { nodeResolve } from '@rollup/plugin-node-resolve';
const terser = require('@rollup/plugin-terser');
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import postcss from 'rollup-plugin-postcss';
import postcssImport from 'postcss-import';
import json from "@rollup/plugin-json"
import { generateSW } from 'rollup-plugin-workbox';
import alias from '@rollup/plugin-alias';
export default {
input: 'ts/index.ts',
plugins: [
alias({
entries: [
{ find: 'crypto', replacement: 'crypto-browserify' },
{ find: 'stream', replacement: 'stream-browserify' },
],
}),
typescript(),
commonjs(),
json(),
// Resolve bare module specifiers to relative paths
nodeResolve({
browser: true,
preferBuiltins: false,
}),
// Minify JS
terser({
ecma: 2020,
module: true,
warnings: true,
}),
// Print bundle summary
copy({
patterns: ['images/**/*'],
}),
postcss({
plugins: [postcssImport()],
inject: false,
minimize: true,
}),
generateSW({
globDirectory: 'server/',
globPatterns: [
'static/*.{js,svg,css,html,json}'
],
swDest: 'server/sw.js',
ignoreURLParametersMatching: [
/^utm_/,
/^fbclid$/
]
}),
],
output: {
dir: 'server/static',
sourcemap: true
},
preserveEntrySignatures: 'strict'
};