H
Hono2mo ago
Łukasz

Serving a SPA with Hono breaks on Chrome but not Firefox.

Hi, I'm serving a vite-react app as described in the docs:
app.use("*", serveStatic({ root: "./dist" }));
app.get("*", serveStatic({ path: "./dist/index.html" }));
app.use("*", serveStatic({ root: "./dist" }));
app.get("*", serveStatic({ path: "./dist/index.html" }));
This has worked well so far, but for some reason, after I've deployed my latest changes, the app no longer loads in Chrome (but still works in firefox). The key error is: Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec. In both cases, the server serves the index.html which contains: <script type="module" crossorigin src="/assets/index-Dbp2VEEQ.js"></script> I'm losing my mind over why the hell is the server returning index.html instead of the actual script ONLY in chrome and when I'm serving this from a VPS. - It works fine when I build & serve this locally - It works fine when I run this in Firefox Any help is greatly appreciated, I've no idea. You can check this problem out at https://staging.getpaperjet.com, the code is https://github.com/MLNativeAI/PaperJet/tree/develop
GitHub
GitHub - MLNativeAI/PaperJet at develop
An open-source, privacy-first document processing platform - GitHub - MLNativeAI/PaperJet at develop
No description
No description
No description
1 Reply
Łukasz
ŁukaszOP2mo ago
Holy shit, it was the cloudflare cache. Gemini saved the day here, didn't see the headers. Leaving this up here for anyone else hitting this issue

Did you find this page helpful?