-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.prod.js
60 lines (57 loc) · 1.6 KB
/
webpack.prod.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
import { merge } from 'webpack-merge';
import { InjectManifest } from 'workbox-webpack-plugin';
import common from './webpack.base.js';
const hash = Array(1)
.fill(null)
.map(() => Math.random().toString(36).substr(2))
.join('');
export default merge(common, {
entry: ['babel-polyfill', 'client.tsx'],
mode: 'production',
output: {
filename: '[name].[contenthash].js',
chunkFilename: '[name].[contenthash].js',
},
devtool: 'source-map',
plugins: [
new InjectManifest({
swSrc: 'service-worker.js',
swDest: '../service-worker.js',
additionalManifestEntries: [
{
url: '/',
revision: hash,
},
{
url: '/?utm_source=homescreen',
revision: hash,
},
{
url: '/?utm_source=homescreen&from_home',
revision: hash,
},
{
url: '/?utm_source=homescreen&from_twa',
revision: hash,
},
{
url: '/manifest.json',
revision: '1',
},
],
}),
],
optimization: {
usedExports: true,
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'all',
},
},
},
},
});