Skip to content

Instantly share code, notes, and snippets.

@sketchminds
Forked from Alexintosh/diff
Created September 13, 2018 05:19
Show Gist options
  • Save sketchminds/61a8378533fa06225986da14e2d7e985 to your computer and use it in GitHub Desktop.
Save sketchminds/61a8378533fa06225986da14e2d7e985 to your computer and use it in GitHub Desktop.
React boilerplate in subfolder
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