Search code snippets, questions, articles...

Deploy React application from subdirectory

The code snippet shows how to deploy your React application from a sub-directory or folder
// OPEN  package.json FILE AND ADD "homepage": "/folder-name/"
{
    "name": "app name",
    "version": "0.1.0",
    ...
    "homepage": "/folder-name/" //ADD THIS AT THE BOTTOM
}

//OPEN ROUTING FILE AND ADD basename={'folder-name'}
<Router history={browserHistory} basename={'folder-name'}>
  <Route path="/" component={App} />
</Router>

Search Index Data (The code snippet can also be found with below search text)

serve react app from folder
Was this helpful?
0 Comments
Programming Feeds
Learn something new everyday on Devsheet