React Router SPA and "Not Found"

Hi,

I’ve created a SPA using React Router (ssr set to false). The build command is set to “npm install && npm run build“ and the publish directory is set to “build“ on Render. Running the build locally puts the index.html in build/client/. When I deploy this to Render as a static site I get 404 Not Found. I saw in other questions that a rewrite needs to be setup:

Source: /*
Destination: /index.html

Action: Rewrite

I still get the same error though. Is there something I’m doing obviously wrong here? Thanks.

Hmm I now seem to be getting:

No routes matched location “/index.html”
oe @ chunk-B7RQU5TL-DDa1oAIQ.js:26
Ao @ chunk-B7RQU5TL-DDa1oAIQ.js:29
Vo @ chunk-B7RQU5TL-DDa1oAIQ.js:29
xf @ entry.client-C78UX1p7.js:24
Pf @ entry.client-C78UX1p7.js:24
md @ entry.client-C78UX1p7.js:24
od @ entry.client-C78UX1p7.js:24
Md @ entry.client-C78UX1p7.js:24
Fd @ entry.client-C78UX1p7.js:24
Nv @ entry.client-C78UX1p7.js:24
Hv @ entry.client-C78UX1p7.js:24
Jd @ entry.client-C78UX1p7.js:24
ss @ entry.client-C78UX1p7.js:24
Ua @ entry.client-C78UX1p7.js:9Understand this warning
No routes matched location “/index.html”
oe @ chunk-B7RQU5TL-DDa1oAIQ.js:26
Ao @ chunk-B7RQU5TL-DDa1oAIQ.js:29
Vo @ chunk-B7RQU5TL-DDa1oAIQ.js:29
xf @ entry.client-C78UX1p7.js:24
Pf @ entry.client-C78UX1p7.js:24
md @ entry.client-C78UX1p7.js:24
od @ entry.client-C78UX1p7.js:24
Md @ entry.client-C78UX1p7.js:24
Fd @ entry.client-C78UX1p7.js:24
_v @ entry.client-C78UX1p7.js:24
Ac @ entry.client-C78UX1p7.js:24
Jd @ entry.client-C78UX1p7.js:24
ss @ entry.client-C78UX1p7.js:24
Ua @ entry.client-C78UX1p7.js:9Understand this warning
entry.client-C78UX1p7.js:24 Uncaught Error: Minified React error #418; <REDACTED_LINK> for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at ga (entry.client-C78UX1p7.js:24:24704)
at Md (entry.client-C78UX1p7.js:24:73947)
at Fd (entry.client-C78UX1p7.js:24:106352)
at Nv (entry.client-C78UX1p7.js:24:106325)
at Hv (entry.client-C78UX1p7.js:24:106185)
at Jd (entry.client-C78UX1p7.js:24:102075)
at ss (entry.client-C78UX1p7.js:24:113726)
at MessagePort.Ua (entry.client-C78UX1p7.js:9:1643)

The build says the index.html exists though I think?

SPA Mode: Generated build/client/index.html

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.