8c88ec6383
* Make SW generation prod-only * Use SpeedMeasurePlugin * Refactor: Symlink directories for dev builds * Lint fix * Remove SpeedMeasurePlugin
30 lines
1 KiB
JavaScript
30 lines
1 KiB
JavaScript
const { merge } = require('webpack-merge')
|
|
const common = require('./webpack.common.js')
|
|
|
|
const CopyPlugin = require('copy-webpack-plugin')
|
|
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
|
|
const webpack = require('webpack')
|
|
const WorkboxPlugin = require('workbox-webpack-plugin')
|
|
|
|
module.exports = merge(common, {
|
|
mode: 'production',
|
|
plugins: [
|
|
new CleanWebpackPlugin(),
|
|
new webpack.optimize.ModuleConcatenationPlugin(),
|
|
new LodashModuleReplacementPlugin(),
|
|
new CopyPlugin({
|
|
patterns: [
|
|
...common[Symbol.for('webpack_directories')],
|
|
...common[Symbol.for('webpack_files')]
|
|
]
|
|
}),
|
|
new WorkboxPlugin.GenerateSW({
|
|
// these options encourage the ServiceWorkers to get in there fast
|
|
// and not allow any straggling "old" SWs to hang around
|
|
clientsClaim: true,
|
|
skipWaiting: true,
|
|
include: ['index.html', 'manifest.json'] // not caching a lot as anyway this works only online
|
|
})
|
|
]
|
|
})
|