From 12917a476601d3b99aebc3cce86c7c52cf71e40f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Fri, 3 Apr 2026 20:17:23 +0800 Subject: [PATCH] =?UTF-8?q?refactor(config):=20=E5=B0=86=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=BB=8E=20TypeScript=20?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E4=B8=BA=20JavaScript?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 config/env.ts 文件并将环境配置转换为 config/env.js - 更新 config/index.ts 中的导入路径以匹配新的 JavaScript 文件扩展名 - 修改 src/utils/server.ts 中的开发服务器 URL 配置 - 更新 tsconfig.json 的 include 配置移除 config 目录 - 调整环境配置中的 API 地址设置统一使用生产环境地址 - 更新 .workbuddy/expert-history.json 中的时间戳记录 --- .workbuddy/expert-history.json | 2 +- config/{env.ts => env.js} | 10 +++++----- config/index.ts | 2 +- src/utils/server.ts | 2 +- tsconfig.json | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) rename config/{env.ts => env.js} (74%) diff --git a/.workbuddy/expert-history.json b/.workbuddy/expert-history.json index a9bc86f..dac490d 100644 --- a/.workbuddy/expert-history.json +++ b/.workbuddy/expert-history.json @@ -13,5 +13,5 @@ } ] }, - "lastUpdated": 1775132225586 + "lastUpdated": 1775141282813 } \ No newline at end of file diff --git a/config/env.ts b/config/env.js similarity index 74% rename from config/env.ts rename to config/env.js index 84d3981..2010f0f 100644 --- a/config/env.ts +++ b/config/env.js @@ -2,21 +2,21 @@ // ============ 环境切换开关(修改这里即可切换环境)============ // 可选值: 'development' | 'test' | 'production' -const CURRENT_ENV: 'production' = 'production' +const CURRENT_ENV = 'production' // =========================================================== export const ENV_CONFIG = { // 开发环境 development: { - API_BASE_URL: 'https://glt-dev-api.websoft.top/api', - SERVER_API_URL: 'https://glt-dev-server.websoft.top/api', + API_BASE_URL: 'https://glt-api.websoft.top/api', + SERVER_API_URL: 'https://glt-server.websoft.top/api', APP_NAME: '开发环境', DEBUG: 'true', }, // 测试环境 test: { - API_BASE_URL: 'https://glt-dev-api.websoft.top/api', - SERVER_API_URL: 'https://glt-dev-server.websoft.top/api', + API_BASE_URL: 'https://glt-api.websoft.top/api', + SERVER_API_URL: 'https://glt-server.websoft.top/api', APP_NAME: '测试环境', DEBUG: 'true', }, diff --git a/config/index.ts b/config/index.ts index b9611c4..448419d 100644 --- a/config/index.ts +++ b/config/index.ts @@ -2,7 +2,7 @@ import { defineConfig, type UserConfigExport } from '@tarojs/cli' import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin' import devConfig from './dev' import prodConfig from './prod' -import { getEnvConfig } from './env' +import { getEnvConfig } from './env.js' // import vitePluginImp from 'vite-plugin-imp' // https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数 diff --git a/src/utils/server.ts b/src/utils/server.ts index 400149e..34b1531 100644 --- a/src/utils/server.ts +++ b/src/utils/server.ts @@ -7,7 +7,7 @@ export const TEMPLATE_ID = '10584'; // @ts-ignore export const SERVER_API_URL = process.env.TARO_ENV === 'production' ? 'https://glt-server.websoft.top/api' - : 'https://glt-dev-server.websoft.top/api'; + : 'https://glt-server.websoft.top/api'; /** * 保存用户信息到本地存储 * @param token diff --git a/tsconfig.json b/tsconfig.json index ea5fb7b..dd4c2af 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -37,6 +37,6 @@ }, "skipLibCheck": true }, - "include": ["./src", "./types", "./config"], + "include": ["./src", "./types"], "compileOnSave": false }