Disable SW caching in dev build
This commit is contained in:
parent
23ac0fef32
commit
fbdd888c3d
@ -78,7 +78,10 @@ async function networkOrCache(event) {
|
||||
}
|
||||
|
||||
if (response.ok) {
|
||||
if (cacheName !== "dev") {
|
||||
event.waitUntil(putInCache(event.request, response));
|
||||
}
|
||||
|
||||
return response.clone();
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,9 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||
const VueLoaderPlugin = require("vue-loader/lib/plugin");
|
||||
const Helper = require("./src/helper.js");
|
||||
|
||||
const isProduction = process.env.NODE_ENV === "production";
|
||||
const config = {
|
||||
mode: process.env.NODE_ENV === "production" ? "production" : "development",
|
||||
mode: isProduction ? "production" : "development",
|
||||
entry: {
|
||||
"js/bundle.js": [path.resolve(__dirname, "client/js/vue.js")],
|
||||
},
|
||||
@ -108,7 +109,9 @@ const config = {
|
||||
from: "./client/service-worker.js",
|
||||
to: "[name].[ext]",
|
||||
transform(content) {
|
||||
return content.toString().replace("__HASH__", Helper.getVersionCacheBust());
|
||||
return content
|
||||
.toString()
|
||||
.replace("__HASH__", isProduction ? Helper.getVersionCacheBust() : "dev");
|
||||
},
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user