fix: 配置文件公共路径无效 (#3007)

This commit is contained in:
k1ngbanana 2023-09-08 22:10:19 +08:00 committed by GitHub
parent aaf2fde3cf
commit a244dcd261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,10 @@ function defineApplicationConfig(defineOptions: DefineOptions = {}) {
return defineConfig(async ({ command, mode }) => { return defineConfig(async ({ command, mode }) => {
const root = process.cwd(); const root = process.cwd();
const isBuild = command === 'build'; const isBuild = command === 'build';
const { VITE_USE_MOCK, VITE_BUILD_COMPRESS, VITE_ENABLE_ANALYZE } = loadEnv(mode, root); const { VITE_PUBLIC_PATH, VITE_USE_MOCK, VITE_BUILD_COMPRESS, VITE_ENABLE_ANALYZE } = loadEnv(
mode,
root,
);
const defineData = await createDefineData(root); const defineData = await createDefineData(root);
const plugins = await createPlugins({ const plugins = await createPlugins({
@ -35,6 +38,7 @@ function defineApplicationConfig(defineOptions: DefineOptions = {}) {
const pathResolve = (pathname: string) => resolve(root, '.', pathname); const pathResolve = (pathname: string) => resolve(root, '.', pathname);
const applicationConfig: UserConfig = { const applicationConfig: UserConfig = {
base: VITE_PUBLIC_PATH,
resolve: { resolve: {
alias: [ alias: [
{ {