Disable workbox when running in webpack dev server, not in dev mode
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
aa9b517664
commit
11e676cee0
2 changed files with 16 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
|||
const path = require('path');
|
||||
const {EnvironmentPlugin} = require('webpack');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
|
@ -32,6 +33,8 @@ module.exports = (env, argv) => {
|
|||
const jsSdkSrcDir = path.resolve(require.resolve("matrix-js-sdk/package.json"), '..', 'src');
|
||||
|
||||
const plugins = [
|
||||
new EnvironmentPlugin(["WEBPACK_DEV_SERVER"]), // pass this as it is used for conditionally loading workbox
|
||||
|
||||
// This exports our CSS using the splitChunks and loaders above.
|
||||
new MiniCssExtractPlugin({
|
||||
filename: 'bundles/[hash]/[name].css',
|
||||
|
@ -92,7 +95,8 @@ module.exports = (env, argv) => {
|
|||
}),
|
||||
];
|
||||
|
||||
if (argv.mode === "production") {
|
||||
const isDevServer = process.env.WEBPACK_DEV_SERVER;
|
||||
if (!isDevServer) {
|
||||
plugins.push(new WorkboxPlugin.GenerateSW({
|
||||
maximumFileSizeToCacheInBytes: 22000000,
|
||||
runtimeCaching: [{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue