2018-01-26 05:32:53 +00:00
|
|
|
const merge = require('webpack-merge')
|
|
|
|
|
|
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin')
|
2018-01-28 03:06:18 +00:00
|
|
|
const OfflinePlugin = require('offline-plugin')
|
2018-02-03 21:48:25 +00:00
|
|
|
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin')
|
2018-03-10 05:58:04 +00:00
|
|
|
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
|
2018-01-26 05:32:53 +00:00
|
|
|
|
|
|
|
const common = require('./webpack.common.js')
|
|
|
|
|
|
|
|
module.exports = merge(common, {
|
2018-03-17 02:51:56 +00:00
|
|
|
mode: 'production',
|
2018-01-26 05:32:53 +00:00
|
|
|
module: {
|
|
|
|
rules: []
|
|
|
|
},
|
|
|
|
plugins: [
|
2018-02-03 21:48:25 +00:00
|
|
|
new SimpleProgressWebpackPlugin({
|
|
|
|
format: 'expanded'
|
|
|
|
}),
|
2018-01-30 03:58:05 +00:00
|
|
|
new CleanWebpackPlugin([
|
|
|
|
'assets/js/*.*',
|
|
|
|
'assets/css/*.*',
|
|
|
|
'assets/*.js',
|
|
|
|
'assets/*.json'
|
|
|
|
], {
|
|
|
|
root: process.cwd(),
|
|
|
|
verbose: false
|
|
|
|
}),
|
2018-03-10 05:58:04 +00:00
|
|
|
new OptimizeCssAssetsPlugin({
|
|
|
|
cssProcessorOptions: { discardComments: { removeAll: true } },
|
|
|
|
canPrint: true
|
|
|
|
}),
|
2018-01-28 03:06:18 +00:00
|
|
|
new OfflinePlugin({
|
2018-03-17 02:51:56 +00:00
|
|
|
ServiceWorker: {
|
|
|
|
minify: false
|
|
|
|
},
|
2018-02-03 21:48:25 +00:00
|
|
|
publicPath: '/',
|
|
|
|
externals: ['/'],
|
2018-01-28 03:06:18 +00:00
|
|
|
caches: {
|
|
|
|
main: [
|
|
|
|
'js/client.js'
|
|
|
|
],
|
2018-02-03 21:48:25 +00:00
|
|
|
additional: [
|
|
|
|
':externals:'
|
|
|
|
],
|
|
|
|
optional: [
|
|
|
|
'js/*.chunk.js'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
safeToUseOptionalCaches: true
|
2018-03-17 02:51:56 +00:00
|
|
|
})
|
2018-01-26 05:32:53 +00:00
|
|
|
]
|
|
|
|
})
|