perf: 优化env字段

This commit is contained in:
vben
2023-04-05 15:58:03 +08:00
parent 358b77fe96
commit aedb8e53aa
10 changed files with 38 additions and 54 deletions

View File

@@ -31,6 +31,7 @@
"stub": "pnpm unbuild --stub"
},
"dependencies": {
"@ant-design/colors": "^7.0.0",
"vite": "^4.3.0-beta.1"
},
"devDependencies": {

View File

@@ -74,7 +74,7 @@ function defineApplicationConfig(defineOptions: DefineOptions = {}) {
output: {
manualChunks: {
vue: ['vue', 'pinia', 'vue-router'],
antdv: ['ant-design-vue', '@ant-design/icons-vue'],
antd: ['ant-design-vue', '@ant-design/icons-vue'],
},
},
},

View File

@@ -26,7 +26,8 @@ async function createAppConfigPlugin({
return {
name: PLUGIN_NAME,
async configResolved(_config) {
const appTitle = _config?.env?.VITE_GLOB_APP_SHORT_NAME ?? '';
let appTitle = _config?.env?.VITE_GLOB_APP_TITLE ?? '';
appTitle = appTitle.replace(/\s/g, '_');
publicPath = _config.base;
source = await getConfigSource(appTitle);
},