refactor: set the root path of the development environment to /console (#638)

#### 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 

测试方式:启动之后访问 <http://localhost:3000/console>,检查控制台是否有资源加载异常。

#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/641/head
Ryan Wang 2022-10-11 23:32:14 +08:00 committed by GitHub
parent 170c027bfe
commit 8b15196a33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -1,2 +1,2 @@
VITE_API_URL=http://localhost:8090
VITE_BASE_URL=/
VITE_BASE_URL=/console/

View File

@ -69,6 +69,16 @@ export const setupLibraryExternal = (
},
];
const injectScript = staticTargets
.map((target) => {
return `<script src="${isProduction ? baseUrl : "/"}${target.dest}/${
target.rename
}"></script>`;
})
.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 `<script src="${baseUrl}${target.dest}/${target.rename}"></script>`;
})
.join("\n"),
injectScript,
},
},
}),