Hello there!
I'm trying to serve a React application from a sub-folder. It's currently a very simple SPA running on the root URL (e.g. http://myse...
For further actions, you may consider blocking this person and/or reporting abuse
I was able to replicate your issue. The problem is
serve
. When you runserve -s build
it starts the HTTP server. When you go tohttp://localhost:5000
in your browser it sends an HTTP request for/
to serve. It will respond with./build/index.html
, which references assets from/newroot/static/....
. But, there is nonewroot
directory inside yourbuild
directory. So it responds with./build/index.html
due to the-s
flag.If you rename the
build
directory tonewroot
and runserve .
then you will be able to load your application at localhost:5000/newroot but navigation may not work correctly depending on what you are doing.If you are trying to test the production deployment of your application you should do so in a production-like environment, not locally.
Keep in mind that "homepage" is only used in production build.
Development still serves the app from "localhost:3000/"
Sure but as you can see in my post I'm serving the app in production mode. And this is where the error happens, nothing changes in dev mode.