Skip to content

Commit 662f31b

Browse files
committed
Explicitly include assets to cache
1 parent ee31f12 commit 662f31b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/webpack.client.config.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const { GenerateSW } = require("workbox-webpack-plugin");
99

1010
const root = path.join(__dirname, "..");
1111
const prod = process.env.NODE_ENV === "production" || process.env.CI === "true";
12+
const cachePattern = /\.(?:png|jpg|jpeg|svg|css|js|ttf|woff|eot|woff2|wasm)$/;
1213

1314
module.exports = (options = {}) => merge(
1415
require("./webpack.general.config")(options), {
@@ -67,9 +68,9 @@ module.exports = (options = {}) => merge(
6768
})
6869
].concat(prod ? [
6970
new GenerateSW({
70-
exclude: [/\.html$/],
71+
include: [cachePattern],
7172
runtimeCaching: [{
72-
urlPattern: new RegExp("^(?!.*\.html)"),
73+
urlPattern: cachePattern,
7374
handler: "StaleWhileRevalidate",
7475
options: {
7576
cacheName: "code-server",

0 commit comments

Comments
 (0)