I am trying to build and serve react app with webpack and nginx.
location /app {
alias /var/www/react-app;
}
And I am using React router
<Switch>
<Route exact path = '/'>
<MainComponent/>
</Route>
<Route exact path = '/another'>
<AnotherComponent/>
</Route>
...
Dev server works as expected, but deploying to nginx I only get blank page.
Adding /app
to all routes: exact path = '/app/xxx'
and runnning production build fixes the problem for production build.
How can I automate this using webpack/nginx?