In my package.json file I have
"homepage" : "http://myname.project.com/myapp",
I build the app using npm run build and the output confirms that a /build directory was created. Output:
102.97 KB build/static/js/main.bfa46b52.js
24.37 KB build/static/css/main.cfe8a47e.css
The project was built assuming it is hosted at /myapp/. You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
If I start the app using npm start or serve -s build the app will start and the index.html page will load, but the references to static resources from index.html are broken (/myapp/static/js/main.js and /myapp/static/css/main.css). I can navigate directly to to them without the /myapp (localhost:5000/static/js/main.js works; localhost:5000/myapp/static/js/main.js does not work)
If I deploy the build folder to a different plain old apache server under a /myapp directory it seems to work as expected. Is there any way I can configure serve -s build to serve up pages from a /myapp directory?
The app is currently one page with no links and no implementation of react-router or anything equivalent. The team had been using webpack, but removed it. The app gets bundled using react-scripts.