From 99d74545f5ec7ce01b2f978fdc87b439d1634dd8 Mon Sep 17 00:00:00 2001
From: Ahad Birang <farnabaz@gmail.com>
Date: Fri, 7 Oct 2022 20:31:23 +0200
Subject: [PATCH 1/3] fix: prevent unwanted reloads on content change

---
 src/hmr.ts    | 2 ++
 src/module.ts | 4 ----
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/hmr.ts b/src/hmr.ts
index 25d3c990..cc6db2a0 100644
--- a/src/hmr.ts
+++ b/src/hmr.ts
@@ -35,6 +35,8 @@ export default function (tailwindConfig: any = {}, rootDir: string, cssPath: str
           }
         })
       })
+      // @ts-ignore
+      return true
     }
   }
 };
diff --git a/src/module.ts b/src/module.ts
index 6c3b1117..7951a43f 100644
--- a/src/module.ts
+++ b/src/module.ts
@@ -204,10 +204,6 @@ export default defineNuxtModule<ModuleOptions>({
     postcssOptions.plugins = postcssOptions.plugins || {}
     postcssOptions.plugins['tailwindcss/nesting'] = postcssOptions.plugins['tailwindcss/nesting'] ?? {}
     postcssOptions.plugins['postcss-custom-properties'] = postcssOptions.plugins['postcss-custom-properties'] ?? {}
-    // Hot fix for Tailwind refreshing in dev when changing markdown files in content
-    if (nuxt.options.dev && tailwindConfig.content) {
-      tailwindConfig.content = tailwindConfig.content.filter((path: string) => !path.includes('/content-cache/parsed'))
-    }
     postcssOptions.plugins.tailwindcss = tailwindConfig
 
     if (isNuxt2()) {

From 865bd62335ed20009ed279e2795b3825208d4b71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= <seb@nuxtjs.com>
Date: Fri, 7 Oct 2022 22:34:03 +0200
Subject: [PATCH 2/3] chore: return only for content-cache

---
 src/hmr.ts | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/hmr.ts b/src/hmr.ts
index cc6db2a0..42e9ce77 100644
--- a/src/hmr.ts
+++ b/src/hmr.ts
@@ -18,6 +18,9 @@ export default function (tailwindConfig: any = {}, rootDir: string, cssPath: str
       for (const mod of extraModules) {
         // This will invalidate Vite cache (e.g. next page reload will be fine), but won't help with HMR on its own
         ctx.server.moduleGraph.invalidateModule(mod, undefined, timestamp)
+        // for (const importedModule of mod.importedModules) {
+        //   console.log(importedModule.id)
+        // }
       }
 
       // Surely, this is not the best way to fix that, especially given direct `send` call bypassing all Vite logic.
@@ -35,8 +38,10 @@ export default function (tailwindConfig: any = {}, rootDir: string, cssPath: str
           }
         })
       })
-      // @ts-ignore
-      return true
+      if (ctx.file.includes('/content-cache/')) {
+        // @ts-ignore
+        return true
+      }
     }
   }
 };

From 6373ba6ebe05fbdbf3b0da3d93b9880c294522cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= <seb@nuxtjs.com>
Date: Fri, 7 Oct 2022 22:35:10 +0200
Subject: [PATCH 3/3] up

---
 src/hmr.ts | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/hmr.ts b/src/hmr.ts
index 42e9ce77..55c35232 100644
--- a/src/hmr.ts
+++ b/src/hmr.ts
@@ -18,9 +18,6 @@ export default function (tailwindConfig: any = {}, rootDir: string, cssPath: str
       for (const mod of extraModules) {
         // This will invalidate Vite cache (e.g. next page reload will be fine), but won't help with HMR on its own
         ctx.server.moduleGraph.invalidateModule(mod, undefined, timestamp)
-        // for (const importedModule of mod.importedModules) {
-        //   console.log(importedModule.id)
-        // }
       }
 
       // Surely, this is not the best way to fix that, especially given direct `send` call bypassing all Vite logic.