-
-
Save sketchminds/61a8378533fa06225986da14e2d7e985 to your computer and use it in GitHub Desktop.
React boilerplate in subfolder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| internals/webpack/webpack.base.babel.js | |
| - publicPath: '/', | |
| + publicPath: '/subfolder/', | |
| File internals/webpack/webpack.prod.babel.js | |
| - publicPath: '/', | |
| + publicPath: '/subfolder/', | |
| app/app.js | |
| -import { applyRouterMiddleware, Router, browserHistory } from 'react-router'; | |
| +import { applyRouterMiddleware, Router, useRouterHistory } from 'react-router'; | |
| +import createBrowserHistory from 'history/lib/createBrowserHistory'; | |
| // this uses the singleton browserHistory provided by react-router | |
| // Optionally, this could be changed to leverage a created history | |
| // e.g. `const browserHistory = useRouterHistory(createBrowserHistory)();` | |
| +const browserHistory = useRouterHistory(createBrowserHistory)({ basename: '/subfolder' }); | |
| const initialState = {}; | |
| app/manifest.json | |
| - "start_url": "index.html", | |
| + "start_url": "/subfolder/index.html", |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment