From c2c697eb4aabc68183159100979e0342082b4e32 Mon Sep 17 00:00:00 2001 From: luhc228 <44047106+luhc228@users.noreply.github.com> Date: Tue, 30 Aug 2022 11:20:56 +0800 Subject: [PATCH] fix: basename order (#491) --- packages/ice/src/utils/getRouterBasename.ts | 2 +- packages/ice/templates/core/entry.client.ts.ejs | 2 +- packages/ice/templates/core/entry.server.ts.ejs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ice/src/utils/getRouterBasename.ts b/packages/ice/src/utils/getRouterBasename.ts index 32482fdfa..716e8bb5e 100644 --- a/packages/ice/src/utils/getRouterBasename.ts +++ b/packages/ice/src/utils/getRouterBasename.ts @@ -3,7 +3,7 @@ import type { Config } from '@ice/types'; import type { TaskConfig } from 'build-scripts'; const getRouterBasename = (taskConfig: TaskConfig, appConfig: AppConfig) => { - return taskConfig?.config?.basename || appConfig?.router?.basename; + return appConfig?.router?.basename ?? taskConfig?.config?.basename ?? ''; }; export default getRouterBasename; diff --git a/packages/ice/templates/core/entry.client.ts.ejs b/packages/ice/templates/core/entry.client.ts.ejs index 8e1c90285..14f5fb191 100644 --- a/packages/ice/templates/core/entry.client.ts.ejs +++ b/packages/ice/templates/core/entry.client.ts.ejs @@ -6,7 +6,7 @@ import Document from '@/document'; const getRouterBasename = () => { const appConfig = getAppConfig(app); - return '<%- basename %>' || appConfig?.router?.basename || ''; + return appConfig?.router?.basename ?? '<%- basename %>' ?? ''; } runClientApp({ diff --git a/packages/ice/templates/core/entry.server.ts.ejs b/packages/ice/templates/core/entry.server.ts.ejs index 0b8cedcb9..86ea77594 100644 --- a/packages/ice/templates/core/entry.server.ts.ejs +++ b/packages/ice/templates/core/entry.server.ts.ejs @@ -9,7 +9,7 @@ import routes from './routes'; const getRouterBasename = () => { const appConfig = runtime.getAppConfig(app); - return '<%- basename %>' || appConfig?.router?.basename || ''; + return appConfig?.router?.basename ?? '<%- basename %>' ?? ''; } const setRuntimeEnv = (renderMode) => {