Use runtime caching for .js and .html files.

This commit is contained in:
Dillon Kearns 2019-09-19 17:01:20 -07:00
parent 936f278e32
commit 87767bab6f
2 changed files with 9 additions and 1 deletions

View File

@ -191,7 +191,7 @@ function webpackOptions(production, routes, { debug, manifestConfig }) {
}),
new InjectManifest({
swSrc: path.resolve(__dirname, "./service-worker-template.js"),
include: [/^index\.html$/, /\.js$/, /\.(?:png|gif|jpg|jpeg|svg)$/],
include: [],
exclude: [
/android-chrome-.*\.png$/,
/apple-touch-icon.*\.png/,

View File

@ -14,6 +14,14 @@ workbox.routing.registerRoute(
}),
"GET"
);
workbox.routing.registerRoute(
/(^index\.html$|.js$)/,
new workbox.strategies.NetworkFirst({
cacheName: "shell",
plugins: []
}),
"GET"
);
workbox.routing.registerRoute(
/^https:\/\/fonts\.googleapis\.com/,
new workbox.strategies.StaleWhileRevalidate({