-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
45 lines (39 loc) · 1.12 KB
/
webpack.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
import webpack from 'webpack'
import OfflinePlugin from 'offline-plugin'
import WebpackPwaManifest from 'webpack-pwa-manifest'
import UglifyJSPlugin from 'uglifyjs-webpack-plugin'
// {
// src: path.resolve('src/assets/icon.png'),
// sizes: [96, 128, 192, 256, 384, 512], // multiple sizes
// }
const manifest = {
name: 'Axi Platform',
display: 'standalone',
short_name: 'Axi',
description: 'Axi Platform. Everywhere, Instantly.',
background_color: '#ffffff',
icons: [],
orientation: 'portrait',
start_url: '.',
inject: false,
ios: false,
fingerprints: true,
filename: 'manifest.json',
// publicPath: null,
}
export default function(config, {stage}) {
if (stage !== 'dev') {
// prettier-ignore
const index = config.plugins.findIndex(x => x instanceof webpack.optimize.UglifyJsPlugin)
// Fix UglifyJS build errors
if (config.plugins[index]) {
config.plugins.splice(index, 1)
config.plugins.push(new UglifyJSPlugin())
}
}
if (stage === 'prod') {
config.plugins.push(new WebpackPwaManifest(manifest))
config.plugins.push(new OfflinePlugin())
}
// return config
}