You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
const merge = require('webpack-merge')
|
|
|
|
|
|
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin')
|
|
|
|
const OfflinePlugin = require('offline-plugin')
|
|
|
|
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin')
|
|
|
|
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
|
|
|
|
|
|
|
|
const common = require('./webpack.common.js')
|
|
|
|
|
|
|
|
module.exports = merge(common, {
|
|
|
|
mode: 'production',
|
|
|
|
module: {
|
|
|
|
rules: []
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new SimpleProgressWebpackPlugin({
|
|
|
|
format: 'expanded'
|
|
|
|
}),
|
|
|
|
new CleanWebpackPlugin([
|
|
|
|
'assets/js/*.*',
|
|
|
|
'assets/css/*.*',
|
|
|
|
'assets/*.js',
|
|
|
|
'assets/*.json'
|
|
|
|
], {
|
|
|
|
root: process.cwd(),
|
|
|
|
verbose: false
|
|
|
|
}),
|
|
|
|
new OptimizeCssAssetsPlugin({
|
|
|
|
cssProcessorOptions: { discardComments: { removeAll: true } },
|
|
|
|
canPrint: true
|
|
|
|
}),
|
|
|
|
new OfflinePlugin({
|
|
|
|
ServiceWorker: {
|
|
|
|
minify: false
|
|
|
|
},
|
|
|
|
publicPath: '/',
|
|
|
|
externals: ['/'],
|
|
|
|
caches: {
|
|
|
|
main: [
|
|
|
|
'js/client.js'
|
|
|
|
],
|
|
|
|
additional: [
|
|
|
|
':externals:'
|
|
|
|
],
|
|
|
|
optional: [
|
|
|
|
'js/*.chunk.js'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
safeToUseOptionalCaches: true
|
|
|
|
})
|
|
|
|
]
|
|
|
|
})
|