It is possible to configure relative paths in React applications created using create-react-app. To do this, the homepage should be set to "./" and the URL should be set to "./".
This will work for hosting the app from any URL, but it will break image URLs in CSS.
If the app is hosted in a subfolder of a static website, a workaround is to specify "./" as the homepage.
This issue discusses how to make relative paths in a React app, which is currently displaying absolute paths. The solution is to set the homepage to "./" and then set the URL to "./". Other contributors suggest that this would work for those who need to host the app from any URL, but it would also break image URLs in CSS.
Relative paths in build output · Issue #165 · facebook/create-react-app · GitHub
This discussion thread is about a problem with the React code, which leads to problems when adding a built react app to a subfolder of a static website. The instructions posted in the console when the build finishes explain how to fix the problem, and a workaround is to specify./ as the homepage if the app is hosted at different paths. The project is optimized for single-page apps, and most of them have client side routing and are served from a consistent location.
Building does not set relative paths to the assets in `static` folder · Issue #527 · facebook/create-react-app · GitHub
npm run build creates a build directory with a production build of your app. Set up your ... This will make sure that all the asset paths are relative to ...
Deployment | Create React App
I had to set homepage to ./ to get relative paths I don't know if it's 'right' but it ... Hi there! react-scripts v0.9.0 was just released which adds support ...
Note: this feature is available with email@example.com and higher. ... run build , Create React App will substitute %PUBLIC_URL% with a correct absolute path ...
Using the Public Folder | Create React App