Skip to content

Instantly share code, notes, and snippets.

@webkreation
Forked from codepunkt/config.json
Created December 2, 2018 10:16
Show Gist options
  • Select an option

  • Save webkreation/78591c0607785a6b38b4c44963f95a5d to your computer and use it in GitHub Desktop.

Select an option

Save webkreation/78591c0607785a6b38b4c44963f95a5d to your computer and use it in GitHub Desktop.

Revisions

  1. @codepunkt codepunkt revised this gist Jul 10, 2017. No changes.
  2. @codepunkt codepunkt revised this gist Jul 10, 2017. No changes.
  3. @codepunkt codepunkt revised this gist Jul 10, 2017. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion react-router-redux.jsx
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    // usage with react-router-redux
    import { ConnectedRouter } from 'react-router-redux'
    import { basePath as basename } from '../config.json'
    import { basePath as basename } from './config.json'

    const history = createHistory({ basename })
    ReactDOM.render(
    2 changes: 1 addition & 1 deletion react-router.jsx
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    // usage with react-router
    import { BrowserRouter } from 'react-router-dom'
    import { basePath as basename } from '../config.json'
    import { basePath as basename } from './config.json'

    ReactDOM.render(
    <BrowserRouter basename={basename}>
  4. @codepunkt codepunkt created this gist Jul 10, 2017.
    3 changes: 3 additions & 0 deletions config.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    {
    "basePath": "/"
    }
    11 changes: 11 additions & 0 deletions react-router-redux.jsx
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    // usage with react-router-redux
    import { ConnectedRouter } from 'react-router-redux'
    import { basePath as basename } from '../config.json'

    const history = createHistory({ basename })
    ReactDOM.render(
    <ConnectedRouter history={history}>
    <App />
    </ConnectedRouter>,
    document.querySelector('#app')
    )
    10 changes: 10 additions & 0 deletions react-router.jsx
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    // usage with react-router
    import { BrowserRouter } from 'react-router-dom'
    import { basePath as basename } from '../config.json'

    ReactDOM.render(
    <BrowserRouter basename={basename}>
    <App />
    </BrowserRouter>,
    document.querySelector('#app')
    )
    13 changes: 13 additions & 0 deletions webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    var publicPath = require('./config.json').basePath

    module.exports = {
    output: {
    publicPath,
    },
    devServer: {
    publicPath,
    historyApiFallback: {
    index: publicPath,
    },
    },
    }