From 8b15196a339abc170c1f6e24cf8aea0ae10d5bc9 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Tue, 11 Oct 2022 23:32:14 +0800 Subject: [PATCH] refactor: set the root path of the development environment to /console (#638) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind improvement /milestone 2.0 #### What this PR does / why we need it: 将开发环境的访问根路径改为 `/console`,即 `http://localhost:3000/console`,方便后续 Halo 对此地址进行反向代理,保证同源。 #### Special notes for your reviewer: /cc @halo-dev/sig-halo-console 测试方式:启动之后访问 ,检查控制台是否有资源加载异常。 #### Does this PR introduce a user-facing change? ```release-note None ``` --- .env.development | 2 +- src/build/library-external.ts | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.env.development b/.env.development index 103b1ea5..fd3af7a7 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,2 @@ VITE_API_URL=http://localhost:8090 -VITE_BASE_URL=/ +VITE_BASE_URL=/console/ diff --git a/src/build/library-external.ts b/src/build/library-external.ts index 02dde28b..69076ead 100644 --- a/src/build/library-external.ts +++ b/src/build/library-external.ts @@ -69,6 +69,16 @@ export const setupLibraryExternal = ( }, ]; + const injectScript = staticTargets + .map((target) => { + return ``; + }) + .join("\n"); + + console.log(injectScript); + return [ ViteExternals({ vue: "Vue", @@ -86,11 +96,7 @@ export const setupLibraryExternal = ( minify: false, inject: { data: { - injectScript: staticTargets - .map((target) => { - return ``; - }) - .join("\n"), + injectScript, }, }, }),