diff --git a/env/.env b/env/.env index 54a92a0..086f1b5 100644 --- a/env/.env +++ b/env/.env @@ -1,5 +1,5 @@ -VITE_APP_TITLE = 'vue3-uniapp' +VITE_APP_TITLE = 'unifly-uniapp' VITE_APP_PORT = 9000 -VIRW_UNI_APPID = 'H5871D791' +VITE_UNI_APPID = 'H5871D791' VITE_WX_APPID = 'wxa2abb91f64032a2b' diff --git a/manifest.config.ts b/manifest.config.ts index f63ec20..8a7243d 100644 --- a/manifest.config.ts +++ b/manifest.config.ts @@ -1,9 +1,14 @@ // manifest.config.ts import { defineManifestConfig } from '@uni-helper/vite-plugin-uni-manifest' +import path from 'node:path' +import { loadEnv } from 'vite' +const env = loadEnv(process.env.NODE_ENV!, path.resolve(process.cwd(), 'env')) +// console.log(env) +const { VITE_APP_TITLE, VITE_UNI_APPID, VITE_WX_APPID } = env export default defineManifestConfig({ - name: 'unifly', - appid: '', + name: VITE_APP_TITLE, + appid: VITE_UNI_APPID, description: '', versionName: '1.0.0', versionCode: '100', @@ -61,7 +66,7 @@ export default defineManifestConfig({ quickapp: {}, /* 小程序特有相关 */ 'mp-weixin': { - appid: '', + appid: VITE_WX_APPID, setting: { urlCheck: false, }, diff --git a/src/manifest.json b/src/manifest.json index 2ca3650..75a22d2 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,6 +1,6 @@ { - "name": "unifly", - "appid": "", + "name": "unifly-uniapp", + "appid": "H5871D791", "description": "", "versionName": "1.0.0", "versionCode": "100", @@ -46,7 +46,7 @@ }, "quickapp": {}, "mp-weixin": { - "appid": "", + "appid": "wxa2abb91f64032a2b", "setting": { "urlCheck": false }, diff --git a/vite.config.ts b/vite.config.ts index 1e61bb5..c49e0cb 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -23,6 +23,8 @@ import autoprefixer from 'autoprefixer' // https://vitejs.dev/config/ export default ({ command, mode }) => { + console.log(mode === process.env.NODE_ENV) + // mode: 区分生产环境还是开发环境 console.log(command, mode) // pnpm dev:h5 时得到 => serve development