florian-lefebvre / astro-tailwind-config-viewer

Explore your Tailwind config visually directly in your browser while developing.
MIT License
10 stars 1 forks source link

404 on _tailwind route in astro 4.5 through 4.8 #2

Closed dcunited001 closed 4 months ago

dcunited001 commented 4 months ago

Hey, i've been running into this issue for awhile, but took a step away from this website's development.

I was able to reproduce this in the with-tailwind example in main branch of with-astro/astro. I entered that directory, renamed tailwind.config.cjs => tailwind.config.mjs and ran:

Here I get a 404 at http://localhost:4321/_tailwind and the following log. I think there may be a race condition involving vite, which is about where I got the last time I looked into this, but i can't remember exactly

15:29:39 [vite] Re-optimizing dependencies because lockfile has changed
15:29:39 [astro-tailwind-config-viewer] Tailwind config viewer is available at http://localhost:4321/_tailwind

 astro  v4.8.2 ready in 377 ms

┃ Local    http://localhost:4321/
┃ Network  use --host to expose

15:29:39 watching for file changes...
15:29:48 [200] / 11ms
15:29:51 [404] /_tailwind 1ms

Here's the diff of changes:

diff --git a/examples/with-tailwindcss/astro.config.mjs b/examples/with-tailwindcss/astro.config.mjs
index 4ad396807..7e8b48166 100644
--- a/examples/with-tailwindcss/astro.config.mjs
+++ b/examples/with-tailwindcss/astro.config.mjs
@@ -1,7 +1,9 @@
 import { defineConfig } from 'astro/config';
 import tailwind from '@astrojs/tailwind';

+import tailwindConfigViewer from "astro-tailwind-config-viewer";
+
 // https://astro.build/config
 export default defineConfig({
-   integrations: [tailwind()],
-});
+  integrations: [tailwind(), tailwindConfigViewer()]
+});
\ No newline at end of file
diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json
index a7db3b3f9..a9da1961d 100644
--- a/examples/with-tailwindcss/package.json
+++ b/examples/with-tailwindcss/package.json
@@ -15,9 +15,10 @@
     "@astrojs/tailwind": "^5.1.0",
     "@types/canvas-confetti": "^1.6.3",
     "astro": "^4.8.2",
+    "astro-tailwind-config-viewer": "^1.0.3",
     "autoprefixer": "^10.4.15",
     "canvas-confetti": "^1.9.1",
     "postcss": "^8.4.28",
-    "tailwindcss": "^3.3.5"
+    "tailwindcss": "^3.4.3"
   }
 }
diff --git a/examples/with-tailwindcss/tailwind.config.cjs b/examples/with-tailwindcss/tailwind.config.mjs
similarity index 100%
rename from examples/with-tailwindcss/tailwind.config.cjs
rename to examples/with-tailwindcss/tailwind.config.mjs
dcunited001 commented 4 months ago

When running npx astro dev --verbose, at the very start, I'm getting the following. I'm looking into this now.

  astro:cli --verbose flag enabled! Enabling: DEBUG="astro:*,vite:*" +0ms
  astro:cli Tip: Set the DEBUG env variable directly for more control. Example: "DEBUG=astro:*,vite:* astro build". +0ms
  astro:telemetry [notify] last notified on 1707958978111 +0ms
  astro:Failed to load config with Node TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /data/ecto/typescript/astro/astro/examples/with-tailwindcss/node_modules/astro-tailwind-config-viewer/src/index.ts
  astro:Failed to load config with Node     at new NodeError (node:internal/errors:405:5)
  astro:Failed to load config with Node     at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:79:11)
  astro:Failed to load config with Node     at defaultGetFormat (node:internal/modules/esm/get_format:124:36)
  astro:Failed to load config with Node     at defaultLoad (node:internal/modules/esm/load:89:20)
  astro:Failed to load config with Node     at nextLoad (node:internal/modules/esm/loader:163:28)
  astro:Failed to load config with Node     at ESMLoader.load (node:internal/modules/esm/loader:603:26)
  astro:Failed to load config with Node     at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
  astro:Failed to load config with Node     at new ModuleJob (node:internal/modules/esm/module_job:64:26)
  astro:Failed to load config with Node     at #createModuleJob (node:internal/modules/esm/loader:480:17)
  astro:Failed to load config with Node     at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34) +0ms
florian-lefebvre commented 4 months ago

Awesome thank you! Will look into it today

florian-lefebvre commented 4 months ago

I just published 2.0, let me know if it works for you

dcunited001 commented 3 months ago

Everything works with the recent updates. 2.0.1 is working great. Thanks!