feat: 更新环境配置和平台支持,支持多端同时调试开发
This commit is contained in:
@@ -5,6 +5,16 @@ import prodConfig from './prod'
|
||||
|
||||
// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数
|
||||
export default defineConfig<'vite'>(async (merge) => {
|
||||
// 不同平台的 appId 配置
|
||||
const appIds = {
|
||||
weapp: process.env.TARO_APP_ID_WEAPP || 'your-weapp-appid',
|
||||
tt: process.env.TARO_APP_ID_TT || 'your-tt-appid',
|
||||
alipay: process.env.TARO_APP_ID_ALIPAY || 'your-alipay-appid',
|
||||
swan: process.env.TARO_APP_ID_SWAN || 'your-swan-appid',
|
||||
qq: process.env.TARO_APP_ID_QQ || 'your-qq-appid',
|
||||
jd: process.env.TARO_APP_ID_JD || 'your-jd-appid'
|
||||
}
|
||||
|
||||
const baseConfig: UserConfigExport<'vite'> = {
|
||||
projectName: 'bw-mini-app',
|
||||
date: '2025-9-1',
|
||||
@@ -16,7 +26,7 @@ export default defineConfig<'vite'>(async (merge) => {
|
||||
828: 1.81 / 2
|
||||
},
|
||||
sourceRoot: 'src',
|
||||
outputRoot: 'dist',
|
||||
outputRoot: process.env.TARO_ENV ? `dist/${process.env.TARO_ENV}` : 'dist',
|
||||
plugins: [
|
||||
"@tarojs/plugin-generator"
|
||||
],
|
||||
@@ -47,6 +57,31 @@ export default defineConfig<'vite'>(async (merge) => {
|
||||
}
|
||||
},
|
||||
},
|
||||
// 小程序平台特定配置
|
||||
weapp: {
|
||||
outputRoot: 'dist/weapp',
|
||||
appId: appIds.weapp
|
||||
},
|
||||
tt: {
|
||||
outputRoot: 'dist/tt',
|
||||
appId: appIds.tt
|
||||
},
|
||||
alipay: {
|
||||
outputRoot: 'dist/alipay',
|
||||
appId: appIds.alipay
|
||||
},
|
||||
swan: {
|
||||
outputRoot: 'dist/swan',
|
||||
appId: appIds.swan
|
||||
},
|
||||
qq: {
|
||||
outputRoot: 'dist/qq',
|
||||
appId: appIds.qq
|
||||
},
|
||||
jd: {
|
||||
outputRoot: 'dist/jd',
|
||||
appId: appIds.jd
|
||||
},
|
||||
h5: {
|
||||
publicPath: '/',
|
||||
staticDirectory: 'static',
|
||||
|
||||
Reference in New Issue
Block a user