微信小程序上传

This commit is contained in:
2026-07-12 14:45:57 +08:00
parent d271ac5b13
commit becf91da52
45 changed files with 1815 additions and 23 deletions
+11
View File
@@ -0,0 +1,11 @@
import type { UserConfigExport } from '@tarojs/cli';
/**
* dev:weapp 下 Vite 会用 prod 模式替换 react 引用,可能导致 useState 等 hooks 失效。
* @see https://docs.taro.zone/docs/config-detail#minidebugreact
*/
export default {
mini: {
debugReact: true,
},
} satisfies UserConfigExport;
+66
View File
@@ -0,0 +1,66 @@
import path from 'node:path';
import { defineConfig } from '@tarojs/cli';
/** 小程序/H5 请求的后端 origin(不含 /api);本地联调可用 VITE_API_TARGET 覆盖 */
const API_ORIGIN = process.env.VITE_API_TARGET ?? 'https://dkapi.runxian.top';
export default defineConfig(async () => ({
projectName: 'mini-user',
date: '2026-7-12',
designWidth: 375,
deviceRatio: {
640: 2.34 / 2,
750: 1,
375: 2,
828: 1.81 / 2,
},
sourceRoot: 'src',
outputRoot: 'dist',
plugins: ['@tarojs/plugin-framework-react', '@tarojs/plugin-html'],
alias: {
react: path.resolve(__dirname, '../node_modules/react'),
'react-dom': path.resolve(__dirname, '../node_modules/react-dom'),
},
defineConstants: {
TARO_APP_API_ORIGIN: JSON.stringify(API_ORIGIN),
},
copy: {
patterns: [
{ from: 'src/assets/', to: 'assets/' },
],
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: 5177,
host: '0.0.0.0',
proxy: {
'/api': {
target: API_ORIGIN,
changeOrigin: true,
},
},
},
postcss: {
autoprefixer: { enable: true, config: {} },
pxtransform: { enable: true, config: {} },
cssModules: { enable: false },
},
},
}));