From bcc758429cc2f438765246a973ccff9f33668315 Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期二, 15 四月 2025 14:00:52 +0800 Subject: [PATCH] fix: bug --- .env.jx | 23 +++++++++++++++++++++++ types/global.d.ts | 2 +- vite.config.ts | 5 +++-- build/plugins.ts | 5 ++++- package.json | 3 +++ 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.env.jx b/.env.jx new file mode 100644 index 0000000..53c45eb --- /dev/null +++ b/.env.jx @@ -0,0 +1,23 @@ +NODE_ENV=production + +# 绾夸笂鐜椤圭洰鎵撳寘璺緞 +VITE_PUBLIC_PATH = / + +# 绾夸笂鐜璺敱鍘嗗彶妯″紡 +VITE_ROUTER_HISTORY = "h5" + +# 绾夸笂鐜鍚庣鍦板潃 +# VITE_PROXY_DOMAIN_REAL = "https://818api.rlwyyun.com" +VITE_PROXY_DOMAIN_REAL = "https://api.jx818.com" + +# 鏄惁涓烘墦鍖呭悗鐨勬枃浠舵彁渚涗紶缁熸祻瑙堝櫒鍏煎鎬ф敮鎸� 鏀寔 true 涓嶆敮鎸� false +VITE_LEGACY = true + +VITE_COMPRESSION = "none" + +# OSS涓婁紶鍦板潃 +VITE_OSS_URL = "https://parkmanagement.oss-cn-hangzhou.aliyuncs.com/" +VITE_OSS_URL_BUCKET = "parkmanagement" +VITE_WEMAP_KEY = "DYRBZ-ZGPCF-X3OJN-N2AA3-JWUCE-HEBXJ" + +VITE_CLIENT_ORIGIN = "https://www.jx818.com" diff --git a/build/plugins.ts b/build/plugins.ts index 03e5af1..07ea4b0 100644 --- a/build/plugins.ts +++ b/build/plugins.ts @@ -44,11 +44,12 @@ type Options = { VITE_LEGACY?: ViteEnv['VITE_LEGACY']; VITE_COMPRESSION?: ViteEnv['VITE_COMPRESSION']; + VITE_WEMAP_KEY?: ViteEnv['VITE_WEMAP_KEY']; VITE_AppType?: ViteEnv['VITE_AppType']; }; export function getPluginsList(command: ConfigEnv['command'], options: Options = {}) { - const { VITE_LEGACY, VITE_COMPRESSION, VITE_AppType } = options; + const { VITE_LEGACY, VITE_COMPRESSION, VITE_WEMAP_KEY, VITE_AppType } = options; // const prodMock = true; const lifecycle = process.env.npm_lifecycle_event; console.log(lifecycle, command); @@ -69,6 +70,8 @@ data: { title: Config.title, subMenuIconCssPath: SubMenuManager.SubMenuIconCssPath, + WEMAP_KEY: VITE_WEMAP_KEY, + isJx: VITE_AppType === 'jx', }, }, }), diff --git a/package.json b/package.json index 6a6f138..b1bef1b 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,11 @@ "version": "1.0.0", "scripts": { "dev": "cross-env vite", + "dev:jx": "cross-env VITE_AppType=jx vite", "build": "cross-env NODE_OPTIONS=--max_old_space_size=16000 vite build", + "build:jx": "cross-env VITE_AppType=jx vite build --mode jx", "build:staging": "cross-env vite build --mode staging", + "build:jx:staging": "cross-env VITE_AppType=jx vite build --mode staging", "build:staging:jenkins": "cross-env NODE_OPTIONS=--max_old_space_size=16000 vite build --mode staging", "preview": "vite preview", "prepare": "husky install", diff --git a/types/global.d.ts b/types/global.d.ts index fa43333..33ce661 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -112,7 +112,7 @@ VITE_COMPRESSION: ViteCompression; VITE_WEMAP_KEY:string; VITE_CLIENT_ORIGIN:string; - VITE_AppType: 'one' ; + VITE_AppType: 'one' | 'jx'; } interface AppConfig { diff --git a/vite.config.ts b/vite.config.ts index 1b96ef9..01fa3b2 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -43,6 +43,7 @@ VITE_PROXY_DOMAIN, VITE_PROXY_DOMAIN_REAL, VITE_COMPRESSION, + VITE_AppType, } = warpperEnv(loadEnv(mode, root)); return { @@ -90,12 +91,12 @@ } : {}, }, - plugins: getPluginsList(command, { VITE_LEGACY, VITE_COMPRESSION }), + plugins: getPluginsList(command, { VITE_LEGACY, VITE_COMPRESSION, VITE_AppType }), define: { __INTLIFY_PROD_DEVTOOLS__: false, }, build: { - outDir: `dist/dist-12333Governmentback-${mode}`, + outDir: `dist/dist-12333Governmentback-${VITE_AppType}-${mode}`, }, optimizeDeps: { include: [ -- Gitblit v1.9.1