2021-03-05 19:29:28 -05:00
|
|
|
const { merge } = require('webpack-merge')
|
|
|
|
const common = require('./webpack.common.js')
|
|
|
|
|
2021-10-26 04:21:28 -04:00
|
|
|
const CopyPlugin = require('copy-webpack-plugin')
|
2021-03-05 19:29:28 -05:00
|
|
|
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
|
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
|
|
|
|
const webpack = require('webpack')
|
2021-10-26 04:21:28 -04:00
|
|
|
const WorkboxPlugin = require('workbox-webpack-plugin')
|
2021-03-05 19:29:28 -05:00
|
|
|
|
|
|
|
module.exports = merge(common, {
|
|
|
|
mode: 'production',
|
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin(),
|
|
|
|
new webpack.optimize.ModuleConcatenationPlugin(),
|
2021-10-26 04:21:28 -04:00
|
|
|
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
|
|
|
|
})
|
2021-03-05 19:29:28 -05:00
|
|
|
]
|
|
|
|
})
|