Daydreamer-riri / vite-react-ssg

Static-site generation for React on Vite.
https://vite-react-ssg.netlify.app/
MIT License
125 stars 6 forks source link

React-Router-Dom Link doesnt work #35

Closed FynniX closed 1 month ago

FynniX commented 1 month ago

Hi, I have the issue that my link to a different route results in a error during a production build. That is only the case when I use the react-router-dom links.

The error complains about the result to be not json. The error also indicates that the result is a html string instead of json.

FynniX commented 1 month ago

I can add a link for reproduction later on.

FynniX commented 1 month ago

After trying to reproduce it with a node.js webserver for reproduction I verified that it is a issue with server configuration. So I will close this issue.

Daydreamer-riri commented 1 month ago

Glad to hear the issue has been resolved. If you have any further questions, please let me know.

FynniX commented 1 month ago

Yeah found out that the static-loader-data-manifest file and the .vite folder inside the dist folder has a usage :) So if anybody has the issue just copy everything to the webserver.

rryando commented 1 month ago

@FynniX may I know the server config that need to be adjust for the <Link /> to outside routes to work, I also have similar issue, this also reproduced by using serve in local but I have no idea why

FynniX commented 1 month ago

@FynniX may I know the server config that need to be adjust for the <Link /> to outside routes to work, I also have similar issue, this also reproduced by using serve in local but I have no idea why

The problem wasn't the config. You need to copy the manifest file and the .vite folder to the webserver. Maybe you have a different issue?

rryando commented 1 month ago

The problem wasn't the config. You need to copy the manifest file and the .vite folder to the webserver. Maybe you have a different issue?

I gues so, I will try again later, I remember that I serve whole dist folder, so .vite and manifest should be on webserver