Jordan
Jordan

Reputation: 25

React Site Showing on Netlify but Not on GitHub Pages

I uploaded my React site to GitHub under the repo jschlte.github.io it displays a blank page with the error of "Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/jsx". Strict MIME type checking is enforced for module scripts per HTML spec". But on Netlify the site loads up just fine.

GitHub Pages: https://jschlte.github.io/
Netlify: https://jschlte.netlify.app/

My package.jsonenter image description here

My vite.config.js file enter image description here

My main.jsx file enter image description here

Upvotes: 0

Views: 136

Answers (1)

Jet2405
Jet2405

Reputation: 11

This github page only host static website. If you develop your web based on Reactjs, you need to translate your codes to pure html/css/js by using tool like webpack. In your case, you only need to npm run build and deploy again to your github repo. Then everything will work.

Upvotes: 1

Related Questions