diff --git a/packages/react-router-dom/modules/BrowserRouter.js b/packages/react-router-dom/modules/BrowserRouter.js index ffd98ef7b1..e18f8ab576 100644 --- a/packages/react-router-dom/modules/BrowserRouter.js +++ b/packages/react-router-dom/modules/BrowserRouter.js @@ -1,7 +1,7 @@ import warning from 'warning' import React from 'react' import PropTypes from 'prop-types' -import createHistory from 'history/createBrowserHistory' +import { createBrowserHistory as createHistory } from 'history' import Router from './Router' /** diff --git a/packages/react-router-dom/modules/HashRouter.js b/packages/react-router-dom/modules/HashRouter.js index 3739fe0571..54f67033ca 100644 --- a/packages/react-router-dom/modules/HashRouter.js +++ b/packages/react-router-dom/modules/HashRouter.js @@ -1,7 +1,7 @@ import warning from 'warning' import React from 'react' import PropTypes from 'prop-types' -import createHistory from 'history/createHashHistory' +import { createHashHistory as createHistory } from 'history' import Router from './Router' /** diff --git a/packages/react-router/modules/MemoryRouter.js b/packages/react-router/modules/MemoryRouter.js index 7e18b861f6..3e04c20495 100644 --- a/packages/react-router/modules/MemoryRouter.js +++ b/packages/react-router/modules/MemoryRouter.js @@ -1,7 +1,7 @@ import warning from 'warning' import React from 'react' import PropTypes from 'prop-types' -import createHistory from 'history/createMemoryHistory' +import {createMemoryHistory as createHistory} from 'history' import Router from './Router' /** diff --git a/packages/react-router/modules/StaticRouter.js b/packages/react-router/modules/StaticRouter.js index c87fb53aad..3d12819115 100644 --- a/packages/react-router/modules/StaticRouter.js +++ b/packages/react-router/modules/StaticRouter.js @@ -2,7 +2,7 @@ import warning from 'warning' import invariant from 'invariant' import React from 'react' import PropTypes from 'prop-types' -import { addLeadingSlash, createPath, parsePath } from 'history/PathUtils' +import { createPath, parsePath } from 'history' import Router from './Router' const normalizeLocation = (object) => { @@ -15,6 +15,10 @@ const normalizeLocation = (object) => { } } +const addLeadingSlash = (path) => { + return path.charAt(0) === '/' ? path : '/' + path; +} + const addBasename = (basename, location) => { if (!basename) return location diff --git a/packages/react-router/modules/__tests__/Route-test.js b/packages/react-router/modules/__tests__/Route-test.js index 554c87f432..2d5f47eb15 100644 --- a/packages/react-router/modules/__tests__/Route-test.js +++ b/packages/react-router/modules/__tests__/Route-test.js @@ -1,6 +1,6 @@ import React from 'react' import ReactDOM from 'react-dom' -import createMemoryHistory from 'history/createMemoryHistory' +import { createMemoryHistory } from 'history' import MemoryRouter from '../MemoryRouter' import Router from '../Router' import Route from '../Route' diff --git a/packages/react-router/modules/__tests__/Router-test.js b/packages/react-router/modules/__tests__/Router-test.js index 0f3fdb29ea..9e63807ed2 100644 --- a/packages/react-router/modules/__tests__/Router-test.js +++ b/packages/react-router/modules/__tests__/Router-test.js @@ -2,7 +2,7 @@ import React from 'react' import ReactDOM from 'react-dom' import PropTypes from 'prop-types' import Router from '../Router' -import createHistory from 'history/createMemoryHistory' +import { createMemoryHistory as createHistory } from 'history' describe('A ', () => { const node = document.createElement('div') diff --git a/packages/react-router/modules/__tests__/SwitchMount-test.js b/packages/react-router/modules/__tests__/SwitchMount-test.js index e02589a587..1e4cba2ad6 100644 --- a/packages/react-router/modules/__tests__/SwitchMount-test.js +++ b/packages/react-router/modules/__tests__/SwitchMount-test.js @@ -1,6 +1,6 @@ import React from 'react' import ReactDOM from 'react-dom' -import createHistory from 'history/createMemoryHistory' +import { createMemoryHistory as createHistory } from 'history' import Router from '../Router' import Switch from '../Switch' import Route from '../Route'