How to change PublicPath for Create React App in Dev Environment
After doing some more googling and searching old issues on github, I have realized that this feature is due for release in react-scripts 2.0 which should include https://github.com/facebook/create-react-app/pull/1887. This will allow subpaths to be included in url from where the files are being served in create-react-app
After I enject the project, I saw these lines:
// We use `PUBLIC_URL` environment variable or "homepage" field to infer
// "public path" at which the app is served.
So, please update PUBLIC_URL in the environment file
You can set PUBLIC_URL
in .env.local
on your local machine.
Be careful to not have this file/variable set when building for release. You can read more about .env
files on cra documenatation.