Repository URL to install this package:
|
Version:
7.1.1 ▾
|
/**
* @file what this does, is load an *in-memory* polyfill of `history` when
* on server, or in test
* @api https://www.npmjs.com/package/history
*/
// @todo
import { createBrowserHistory, createMemoryHistory } from 'history'
const history = (
typeof window !== 'object' ||
process.env.BUILD_FLAG_IS_SERVER === 'true' ||
process.env.NODE_ENV === 'test'
) ? createMemoryHistory : createBrowserHistory
// if (
// typeof window !== 'object' ||
// process.env.BUILD_FLAG_IS_SERVER === 'true' ||
// process.env.NODE_ENV === 'test'
// ) {
// // console.log('memoryHistory')
// history = require('history').createMemoryHistory
// } else {
// // console.log('browserHistory')
// history = require('history').createBrowserHistory
// }
let created
const makeHistory = (props?: any) => {
if (created !== undefined) {
return created
}
created = history()
return created
}
export { makeHistory }
export default makeHistory