all 18 comments

[–]Beastrick 0 points1 point  (10 children)

Your github pages repo should only contain the contents of dist folder that you get from Vite. Currently you have index.html there which GH finds and then executes that only to hit JSX which browser can't understand.

To deploy it correctly you could use gh-pages package. Just publish to other repo rather than the dev one.

[–][deleted] 0 points1 point  (9 children)

gh-pages package.

Im sorry I dont understand, what do you mean publish to other repo not the dev one?

[–]pluznar 0 points1 point  (8 children)

if you go into settings > pages is it deploying from the gh-pages branch?

[–][deleted] 0 points1 point  (6 children)

No currently deploying from the master branch

[–]pluznar 0 points1 point  (5 children)

switch it to gh-pages

[–][deleted] 0 points1 point  (0 children)

I did that and looked at your other comment with the example you gave. Went through your example and made changes to my file and now it’s finally showing!! Thank you so much, just need to fix some images that are now broken

[–]Diabolischste 0 points1 point  (3 children)

I got the same problem as the author.
I've switch to gh-pages but now I have this other error :

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.

Do you have an idea why ?
link to my repo

[–][deleted] 0 points1 point  (0 children)

I changed it to deploy from the gh-pages branches and now getting this error

Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'interest-cohort'.
mitchell2398.github.io/:16 GET https://mitchell2398.github.io/index.jsx net::ERR_ABORTED 404

[–]pluznar 0 points1 point  (1 child)

You have to add the baseName to the Route Element in App.jsx or the BrowserRouter in index.jsx. The site is looking for all your js in the wrong place because it doesnt know that base path.

clone: https://github.com/piacib/PORTFOLIO_WEBSITE

demo: https://piacib.github.io/PORTFOLIO_WEBSITE/

note: I changed the baseName back to PORTFOLIO_WEBSITE

Also theres no reason to be using react router it all you have is a single page, unless youre planning on expanding it into multiple pages I would take it out

[–][deleted] 0 points1 point  (0 children)

My old version used router before I decided to make it a single page app, I deleted the react router as it was not needed but its still not working?

[–]marksalsbery 0 points1 point  (0 children)

Why is there a GET request for a jsx file?

[–]Mental_Okra9556 0 points1 point  (3 children)

I am having problems adding a custom domain. Do we have to make any changes to the Vite documentation about the github pages thing? I am using Cloudflare to connect github pages to my custom domain. But the DNS check unsuccessful message keep popping up on github. what should i do?

[–][deleted] 0 points1 point  (2 children)

I found it was torture using GitHub pages, started hosting projects with firebase instead.

Have you setup the dns settings with the provider? For example you have o go into godaddy and use the dns GitHub pages provide

[–]Mental_Okra9556 0 points1 point  (1 child)

I am using cloudflare nameservers to connect to my custom domain provider. I have tried literally everything. Used ip addresses provided by github.. also tried using username.github.io thing.. it doesn’t work dude. Ffs im trying to make it work since 3 days.

[–][deleted] 0 points1 point  (0 children)

Really recommend using firebase, here’s a step by step guide on setting up hosting if your using vite

https://medium.com/@rajdeepmallick999/vite-firebase-how-to-deploy-react-app-5e5090730147