npm run build can trigger the build process but it generates code assuming the base url doesnt have any relative path , but what if i want to deploy to a relative path in my server ??.
So what i mean by relative path is that, I have a simpleapp folder inside my tomcat webapps directory and i want to access my react app from that i.e http://localhost/simpleapp .
It gets even more complex if you use react router .
I was getting a blank page but later, I found Some changes done on react router and package.json that solved my issue .
So the solutions that i found are :-
Mention homepage property in package.json
"homepage": "https://localhost:8080/simpleapp",
For react router we must add basename property .
In above case for app to be deployed on simpleapp relative path
<Router basename={'/simpleapp'}>
<Route path='/' component={Home} />
{/* … */}
</Router>