This answer suggests overriding PUBLIC_URL when running in in development, and is exactly what I need (see immediately below).
{
// ...
"scripts": {
"build": "react-scripts build",
"build-localhost": "PUBLIC_URL=/ react-scripts build"
// ...
}
// ...
}
How do I actually make use of this though? I tried building like this
npm run-script build-localhost
But I got an error saying
'PUBLIC_URL' is not recognized as an internal or external command
The app I'm trying to use this in is a ASP.NET Core 3.1 webapp with React inside, but my React knowledge is very limited. When I start the app in Visual Studio I want it to be running the app with a public URL of '/'.