chore(dev): move local API default port to 3010
Avoid conflict with another local service on 3000; align Vite proxies and docs.
This commit is contained in:
@@ -16,7 +16,7 @@ export default defineConfig(async () => ({
|
||||
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'),
|
||||
TARO_APP_API_ORIGIN: JSON.stringify(process.env.VITE_API_TARGET ?? 'http://localhost:3010'),
|
||||
},
|
||||
copy: {
|
||||
patterns: [],
|
||||
@@ -44,7 +44,7 @@ export default defineConfig(async () => ({
|
||||
host: '0.0.0.0',
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: process.env.VITE_API_TARGET ?? 'http://localhost:3000',
|
||||
target: process.env.VITE_API_TARGET ?? 'http://localhost:3010',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ function resolveApiBase(): string {
|
||||
typeof TARO_APP_API_ORIGIN !== 'undefined' && TARO_APP_API_ORIGIN
|
||||
? TARO_APP_API_ORIGIN
|
||||
: process.env.TARO_ENV === 'h5'
|
||||
? 'http://localhost:3000'
|
||||
? 'http://localhost:3010'
|
||||
: '';
|
||||
if (origin) {
|
||||
return `${origin.replace(/\/$/, '')}/api/v1`;
|
||||
|
||||
Reference in New Issue
Block a user