59 lines
1.3 KiB
TypeScript
59 lines
1.3 KiB
TypeScript
import { defineConfig } from '@tarojs/cli';
|
|
|
|
// 总部管理端 Taro 配置:先 H5,后续 weapp(微信小程序)
|
|
export default defineConfig(async () => ({
|
|
projectName: 'mini-hq',
|
|
date: '2026-7-5',
|
|
designWidth: 375,
|
|
deviceRatio: {
|
|
640: 2.34 / 2,
|
|
750: 1,
|
|
375: 2,
|
|
828: 1.81 / 2,
|
|
},
|
|
sourceRoot: 'src',
|
|
outputRoot: 'dist',
|
|
plugins: ['@tarojs/plugin-html'],
|
|
defineConstants: {
|
|
/** H5 静态托管无 /api 代理时直连后端;dev 构建可通过 VITE_API_TARGET 覆盖 */
|
|
TARO_APP_API_ORIGIN: JSON.stringify(process.env.VITE_API_TARGET ?? 'http://localhost:3000'),
|
|
},
|
|
copy: {
|
|
patterns: [],
|
|
options: {},
|
|
},
|
|
framework: 'react',
|
|
compiler: {
|
|
type: 'vite',
|
|
vitePlugins: [],
|
|
},
|
|
cache: {
|
|
enable: false,
|
|
},
|
|
mini: {
|
|
postcss: {
|
|
pxtransform: { enable: true, config: {} },
|
|
cssModules: { enable: false },
|
|
},
|
|
},
|
|
h5: {
|
|
publicPath: '/',
|
|
staticDirectory: 'static',
|
|
devServer: {
|
|
port: 5176,
|
|
host: '0.0.0.0',
|
|
proxy: {
|
|
'/api': {
|
|
target: process.env.VITE_API_TARGET ?? 'http://localhost:3000',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
postcss: {
|
|
autoprefixer: { enable: true, config: {} },
|
|
pxtransform: { enable: true, config: {} },
|
|
cssModules: { enable: false },
|
|
},
|
|
},
|
|
}));
|