UNPKG

475 BJavaScriptView Raw
1/**
2 * 从 koot 配置对象中获取当前环境的 history 类型
3 * @async
4 * @param {Object} kootConfig
5 * @returns {String}
6 */
7module.exports = async (kootConfig) => {
8 if (process.env.WEBPACK_BUILD_STAGE === 'server')
9 return 'memoryHistory'
10
11 const {
12 historyType = process.env.WEBPACK_BUILD_TYPE === 'spa' ? 'hash' : 'browser'
13 } = kootConfig
14 const type = historyType.replace(/history$/i, '')
15 return `${type}History`
16}