fix(mini-user): restore production API origin for H5 builds
CI / verify (pull_request) Has been cancelled

Production builds were baking localhost:3000 after the local-dev default change, causing failed to fetch on product list.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-17 09:30:09 +08:00
parent 00b52b9aaa
commit 972bdde650
3 changed files with 7 additions and 3 deletions
+4 -2
View File
@@ -2,8 +2,10 @@ import { createRequire } from 'node:module';
import path from 'node:path';
import { defineConfig } from '@tarojs/cli';
/** 小程序/H5 请求的后端 origin(不含 /api);发版/连远程请设 VITE_API_TARGET */
const API_ORIGIN = process.env.VITE_API_TARGET ?? 'http://localhost:3000';
/** 小程序/H5 请求的后端 origin(不含 /api);本地默认本机,生产构建默认远程 */
const API_ORIGIN =
process.env.VITE_API_TARGET ??
(process.env.NODE_ENV === 'production' ? 'https://dkapi.runxian.top' : 'http://localhost:3000');
const requireFromApp = createRequire(path.resolve(__dirname, '../package.json'));