forked from udacity/mws-restaurant-stage-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
69 lines (68 loc) · 1.88 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
61
62
63
64
65
66
67
68
69
const path = require('path');
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const HtmlCriticalWebpackPlugin = require('html-critical-webpack-plugin');
const WebpackPwaManifest = require('webpack-pwa-manifest');
module.exports = merge(common, {
mode: 'production',
optimization: {
minimize: true,
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: true
}),
new OptimizeCSSAssetsPlugin({})
]
},
plugins: [
new CleanWebpackPlugin('dist', { dry: false }),
new HtmlCriticalWebpackPlugin({
base: path.resolve(__dirname, 'dist/'),
src: 'index.html',
dest: 'index.html',
inline: true,
minify: true,
extract: false,
width: 375,
height: 667,
penthouse: {
blockJSRequests: false
}
}),
new HtmlCriticalWebpackPlugin({
base: path.resolve(__dirname, 'dist/'),
src: 'restaurant.html',
dest: 'restaurant.html',
inline: true,
minify: true,
extract: false,
width: 375,
height: 667,
penthouse: {
blockJSRequests: false
}
}),
new WebpackPwaManifest({
filename: 'manifest.json',
name: 'MWS Restaurants - Stage 3',
short_name: 'MWS Restaurants',
description: 'Mobile Web Specialist Restaurant Reviews App',
background_color: '#4285f4',
theme_color: '#4285f4',
'theme-color': '#4285f4',
start_url: '/',
icons: [
{
src: path.resolve('src/img/launcher.png'),
sizes: [48, 96, 128, 192, 256, 384, 512],
destination: path.join('img', 'icons')
}
]
})
]
});