chore: 调整环境配置

This commit is contained in:
wangxuefeng
2025-03-03 18:39:15 +08:00
parent 7c6a86edf6
commit 09ff94c188
14 changed files with 30 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
# 只在开发模式中被载入
ENV = 'development'
VITE_NODE_ENV = 'development'
# 公共基础路径, 详见: https://cn.vitejs.dev/guide/build.html#public-base-path
VITE_BASE_URL = /

View File

@@ -1,5 +1,5 @@
# 只在生产模式中被载入
ENV = 'production'
VITE_NODE_ENV = 'production'
# 公共基础路径, 详见: https://cn.vitejs.dev/guide/build.html#public-base-path
VITE_BASE_URL = /

View File

@@ -1,5 +1,5 @@
# 只在预发布模式中被载入
ENV = 'staging'
VITE_NODE_ENV = 'staging'
# 公共基础路径, 详见: https://cn.vitejs.dev/guide/build.html#public-base-path
VITE_BASE_URL = /

View File

@@ -6,6 +6,7 @@ import path from "path";
// @ts-ignore
export default defineConfig(({ mode }) => {
console.log("mode", mode);
const env = loadEnv(mode, process.cwd(), ["VITE_"]);
return {
@@ -26,10 +27,10 @@ export default defineConfig(({ mode }) => {
// 注入环境变量到客户端
"process.env": JSON.stringify(env),
},
output: {
path: path.resolve(process.cwd(), "../../dist/renderer"),
clean: true,
},
// output: {
// path: path.resolve(process.cwd(), "../../dist/renderer"),
// clean: true,
// },
},
};
});