]> Untitled Git - lemmy-ui.git/blobdiff - webpack.config.js
component classes v2
[lemmy-ui.git] / webpack.config.js
index ef5717fef35646c1cc1f5dd97b44628316b87a65..67b10a986fdbd5691e158febe36e9b6ab5185668 100644 (file)
@@ -69,10 +69,10 @@ const createServerConfig = (_env, mode) => {
   });
 
   if (mode === "development") {
-    config.cache = {
-      type: "filesystem",
-      name: "server",
-    };
+    // config.cache = {
+    //   type: "filesystem",
+    //   name: "server",
+    // };
 
     config.plugins.push(
       new RunNodeWebpackPlugin({
@@ -94,7 +94,7 @@ const createClientConfig = (_env, mode) => {
     plugins: [
       ...base.plugins,
       new ServiceWorkerPlugin({
-        enableInDevelopment: true,
+        enableInDevelopment: mode !== "development", // this may seem counterintuitive, but it is correct
         workbox: {
           modifyURLPrefix: {
             "/": "/static/",
@@ -123,9 +123,12 @@ const createClientConfig = (_env, mode) => {
               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,
+                },
               },
             },
             {
@@ -146,10 +149,10 @@ const createClientConfig = (_env, mode) => {
   });
 
   if (mode === "development") {
-    config.cache = {
-      type: "filesystem",
-      name: "client",
-    };
+    // config.cache = {
+    //   type: "filesystem",
+    //   name: "client",
+    // };
   }
 
   return config;