Skip to content

Commit

Permalink
feat: history must be ‘browser’ when ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohuoni committed Aug 24, 2021
1 parent e889ec1 commit e2d0a84
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/umi-presets-alita/src/plugins/defaultConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IApi, IConfig } from '@umijs/types';

export default (api: IApi) => {
// 这几个配置需要合并配置
const { externals = {}, scripts = [] } = api.userConfig;
const { externals = {}, scripts = [], ssr } = api.userConfig;
const defaultOptions = {
history: { type: 'hash' },
title: false, // 默认内置了 Helmet
Expand Down Expand Up @@ -34,6 +34,10 @@ export default (api: IApi) => {
},
...api.userConfig
} as IConfig;
// ssr 路由必须是 browser
if (ssr) {
defaultOptions.history = { type: 'browser' }
}
api.modifyDefaultConfig((memo) => {
return {
...memo,
Expand Down

0 comments on commit e2d0a84

Please sign in to comment.