T
TanStack13mo ago
ratty-blush

Routes not loading if navigated directly to it

Hi! I'm trying to figure out why after building I can't open links directly to nested routes, as it cant find any of the assets (JS and CSS bundles) I believe this is a vite thing but i followed the docs and doesn't mention anything about the base route, any ideas on how to fix this? For example: https://supersecretDomain.com/cabina works as it should, but https://supersecretDomain.com/cabina/1 where routes is defined as /_layout/cabina/$serviceOrderId doesn't load
4 Replies
ratty-blush
ratty-blushOP13mo ago
Here is an example:
Refused to apply style from 'https://supersecretDomain.com/cabina/assets/index-BaWnasNQ.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Refused to apply style from 'https://supersecretDomain.com/cabina/assets/index-BaWnasNQ.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
When it should be looking for the file at the route of https://supersecretDomain.com where it really is, navigate through the application works correctly
ambitious-aqua
ambitious-aqua13mo ago
Make sure your index.html is referencing your bundles using absolute pathing and not using relative links. Other than that, vite should be handling the rest of it just fine.
harsh-harlequin
harsh-harlequin8mo ago
I'm getting similar errors
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.
dev--consultin.netlify.app/:1 Refused to apply style from 'https://dev--consultin.netlify.app/_build/assets/globals-CAKGvAtV.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
client-SwXFrCZs.js:1 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.
dev--consultin.netlify.app/:1 Refused to apply style from 'https://dev--consultin.netlify.app/_build/assets/globals-CAKGvAtV.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
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.
dev--consultin.netlify.app/:1 Refused to apply style from 'https://dev--consultin.netlify.app/_build/assets/globals-CAKGvAtV.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
client-SwXFrCZs.js:1 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.
dev--consultin.netlify.app/:1 Refused to apply style from 'https://dev--consultin.netlify.app/_build/assets/globals-CAKGvAtV.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
I'm used to the absolute path and then switched to TS Path Aliases. It failed to load the CSS file in both cases https://dev--consultin.netlify.app/ Can anyone advise?
foreign-sapphire
foreign-sapphire6mo ago
Did you ever figure out the error ?

Did you find this page helpful?