-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make SW generation prod-only * Use SpeedMeasurePlugin * Refactor: Symlink directories for dev builds * Lint fix * Remove SpeedMeasurePlugin
- Loading branch information
Showing
3 changed files
with
65 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,30 @@ | ||
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 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 | ||
}) | ||
] | ||
}) |