From 6399df7f9e6f90e857a5e39616340221063fb262 Mon Sep 17 00:00:00 2001
From: heongle <39309769+heongle@users.noreply.github.com>
Date: Sun, 10 Nov 2024 06:08:45 +0800
Subject: [PATCH] fix: fix runtime caching error and adjust rules (#3970)

* fix: fix runtime caching error and adjust rules

* fix: add cache config for ts and m3u8

* revert ts and m3u8 cache config to previous behaviour

* remove unused runtime caching config

* remove all runtime caching config

---------

Co-authored-by: Gabe Kangas <gabek@real-ity.com>
---
 web/next.config.js | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/web/next.config.js b/web/next.config.js
index 8d95f37668..4ce716c418 100644
--- a/web/next.config.js
+++ b/web/next.config.js
@@ -3,28 +3,10 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
   enabled: process.env.ANALYZE === 'true',
 });
 const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');
-const runtimeCaching = require('next-pwa/cache');
 
 const withPWA = require('next-pwa')({
   dest: 'public',
-  runtimeCaching: [
-    {
-      urlPattern: /\.(?:ts|m3u8)$/i,
-      handler: 'NetworkOnly',
-    },
-    {
-      urlPattern: (url) => { return url.pathname.startsWith("/admin/"); },
-      handler: 'NetworkOnly',
-      options: {
-        fetchOptions: { credentials: 'same-origin' }
-      }
-    },
-    {
-      urlPattern: (url) => { return url.pathname.startsWith("/api/"); },
-      handler: 'NetworkOnly',
-    },
-    ...runtimeCaching,
-  ],
+  runtimeCaching: [],
   register: true,
   skipWaiting: true,
   disableDevLogs: true,
@@ -77,7 +59,17 @@ module.exports = async phase => {
           unoptimized: true,
         },
         swcMinify: true,
-        transpilePackages: [ "antd", "@ant-design", "rc-util", "rc-pagination", "rc-picker", "rc-notification", "rc-tooltip", "rc-tree", "rc-table" ],
+        transpilePackages: [
+          'antd',
+          '@ant-design',
+          'rc-util',
+          'rc-pagination',
+          'rc-picker',
+          'rc-notification',
+          'rc-tooltip',
+          'rc-tree',
+          'rc-table',
+        ],
         webpack(config) {
           config.module.rules.push({
             test: /\.svg$/i,