forked from GoogleChromeLabs/sample-pie-shop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
52 lines (50 loc) · 1.37 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
const webpack = require('webpack');
const merge = require('webpack-merge');
const MinifyPlugin = require('babel-minify-webpack-plugin');
const { InjectManifest } = require('workbox-webpack-plugin');
const common = require('./webpack.common.js');
module.exports = merge.smart(common, {
mode: 'production',
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
shouldPrintComment: () => false,
compact: true,
},
},
},
],
},
plugins: [
new MinifyPlugin({ simplify: false, mangle: false }),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
new InjectManifest({
swSrc: './src/sw.prod.js',
swDest: 'sw.js',
globDirectory: 'dist/static',
globPatterns: [
'styles/*.css',
'images/icons/image-fallback.svg',
],
templatedUrls: {
'/?fragment=true': [
'../templates/views/index.hbs',
'../templates/partials/*.hbs',
],
'/app-shell': [
'../server/routes/app-shell.js',
'../templates/layouts/layout.hbs',
'../templates/views/app-shell.hbs',
// POI: This is relying on all partials now, probably not all needed.
'../templates/partials/*.hbs',
],
},
})
],
});