Am using Node js React and vite as the build tool. The project has two folders a client and server folder. The server folder is hosted in render.com and client is hosted on netlify. Here is the link
initially, I keep getting this error :
/src/main.jsx:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “application/octet-stream”. Strict MIME type checking is enforced for module scripts per HTML spec.
then I solved it by going through the netlify support,but the CSS(Tailwindcss) is not working/loading now.
the page is only loading the raw HTML,
when I run the npm run build locally in my Vs Code and open the index.html inside the dist with live server it is working fine all the css/tailwindcss is loading the page is working fine but the CSS/tailwind is not loading/working when deployed in netlify.
If the contents of the CSS file appear wrong, and you’re seeing a difference between “development” and “build” it could be that your “build” doesn’t operate with the same configuration as your “develop” command.
@markIB What precisely do you mean by “live server”?
I’m concerned you might be “running the build” then “running the dev server”, and that you think that means your “build” has worked ok.
Only the command that I wrote shows you the result of the “build”.
If you run the “dev” command, then you’re looking at the “dev” server output, which quite frequently with Vite doesn’t result in the same thing as the “build”.
Did you run npm run build && npm run preview?
If so, what did you see?
(That’s just a blank project I created with npm create vite@latest - to demonstrate what the npm run build && npm run preview command should do)
If you’re having difficulty with Vite’s preview server, you could try serving your build output withnpx serve (https://www.npmjs.com/package/serve).
It doesn’t really matter what you use, the main point is just to “actually be looking at the result of your build” so you can confirm the issue is being caused by the build (not something in the CI environment / host).
In your screenshot your preview tries to run react-env --env env --vite preview
But then immediately dies because it doesn’t know what to do for react-env
You’ve indicated you are looking at localhost:5173
(I can’t tell what you were actually looking at, as you didn’t include it in the screenshot.)
Is it possible you’re getting confused?
Perhaps starting the ‘preview server’, but then accidentally looking at the ‘dev server’ (which you still have running)?