import type { UserConfigExport } from '@tarojs/cli'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; const portal = process.env.TARO_APP_PORTAL || 'student'; const configDir = path.dirname(fileURLToPath(import.meta.url)); const distDirByPortal: Record = { student: 'dist/h5-student', 'tenant-admin': 'dist/h5-tenant-admin', 'platform-admin': 'dist/h5-platform-admin', }; const outputRoot = distDirByPortal[portal] || distDirByPortal.student; export default { projectName: 'tiku-saas-taro', date: '2026-06-29', designWidth: 750, deviceRatio: { 640: 2.34 / 2, 750: 1, 828: 1.81 / 2, }, sourceRoot: 'src', outputRoot, framework: 'react', compiler: { type: 'webpack5', prebundle: { enable: false, }, }, alias: { '@': path.resolve(configDir, '..', 'src'), }, defineConstants: {}, copy: { patterns: [ { from: path.resolve(configDir, '..', 'src', 'assets'), to: path.resolve(configDir, '..', outputRoot, 'assets'), }, ], options: {}, }, h5: { publicPath: '/', staticDirectory: 'static', output: { filename: 'js/[name].[contenthash:8].js', chunkFilename: 'js/[name].[contenthash:8].js', }, router: { mode: 'browser', }, }, mini: { postcss: { pxtransform: { enable: true, config: {}, }, cssModules: { enable: false, }, }, }, } satisfies UserConfigExport;