-
-
Save Alexintosh/ef771099efdd14012e2ad5561f286d39 to your computer and use it in GitHub Desktop.
React boilerplate in subfolder
This file contains 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", |
how the "applyRouterMiddleware" work ??
what is the funtion!!!!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! I've been looking for this solution, but couldn't get a straight answer. 👍