});
if (mode === "development") {
- config.cache = {
- type: "filesystem",
- name: "server",
- };
+ // config.cache = {
+ // type: "filesystem",
+ // name: "server",
+ // };
config.plugins.push(
new RunNodeWebpackPlugin({
plugins: [
...base.plugins,
new ServiceWorkerPlugin({
- enableInDevelopment: true,
+ enableInDevelopment: mode !== "development", // this may seem counterintuitive, but it is correct
workbox: {
modifyURLPrefix: {
"/": "/static/",
urlPattern: ({ url: { pathname, host }, sameOrigin }) =>
(sameOrigin || host.includes("localhost")) &&
pathname.includes("static"),
- handler: "CacheFirst",
+ handler: mode === "development" ? "NetworkFirst" : "CacheFirst",
options: {
cacheName: "static-cache",
+ expiration: {
+ maxAgeSeconds: 60 * 60 * 24,
+ },
},
},
{
});
if (mode === "development") {
- config.cache = {
- type: "filesystem",
- name: "client",
- };
+ // config.cache = {
+ // type: "filesystem",
+ // name: "client",
+ // };
}
return config;