# react19-template **Repository Path**: xiaohoubin/react19-template ## Basic Information - **Project Name**: react19-template - **Description**: react19-template初始化模版 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-15 - **Last Updated**: 2026-01-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 多模板專案操作說明 / Multi-template Project Instructions 本專案採用多模板(template)架構,透過統一指令管理模板建立、刪除、更新、開發與打包流程。 This project uses a multi-template architecture. Templates can be created, deleted, updated, served, and built via unified commands. ## 指令總覽 / Commands Overview ### 建立模板 / Create Template `npm run create:template ` 從 `default` 模板複製建立新的 template,會自動產生 `.env.` 檔案並更新 `tsconfig.app.json` 中的 path 設定。 Copies the `default` template into a new one named ``, generates `.env.`, and updates TypeScript path config. ### 刪除模板 / Delete Template `npm run delete:template ` 刪除對應的模板資料夾與 `.env.`,並更新 `tsconfig.app.json`。 Removes the specified template folder and its `.env` file, and updates the TypeScript path config. ### 更新 TypeScript 路徑 / Update tsconfig paths `npm run update-tsconfig-paths` 重新掃描 template 資料夾並同步 `tsconfig.app.json` 設定(通常不需手動執行)。 Rescans the `templates` directory and updates the TypeScript path config. Usually not needed manually. ### 開發模式 / Serve Mode `npm run serve: -- template=` 可用的 `` 為:`uat`、`pp`、`prod` 範例:`npm run serve:uat -- template=brandA` 啟動指定模板於對應環境的開發模式下。 Starts the specified template in the given environment's serve mode. ### 打包模式 / Build Mode `npm run build: -- template=` 可用的 `` 為:`uat`、`pp`、`prod` 範例:`npm run build:prod -- template=brandA` 將指定模板打包為對應環境版本。 Builds the specified template for the target environment. ## 使用流程建議 / Recommended Workflow 1. 建立模板 `npm run create:template brandA` → 複製 `src/templates/default` → `src/templates/brandA` → 建立 `.env.brandA`,保留 key、清空值 → 自動更新 `tsconfig.app.json` 的 paths 設定 2. 刪除模板 `npm run delete:template brandA` → 移除 `src/templates/brandA` 與 `.env.brandA` → 自動更新 `tsconfig.app.json` ## 注意事項 / Notes - `create` 與 `delete` 會自動觸發 `update-tsconfig-paths`,通常無需手動執行。 `create` and `delete` automatically update the TypeScript paths. - 所有 serve / build 指令需帶上 `-- template=`,否則會報錯。 All serve/build commands **require** the `-- template` flag. - 模板名稱建議使用小寫,並符合目錄命名規則。 Template names should use lowercase and follow folder naming conventions. - 執行時會根據 `VITE_TEMPLATE` 自動載入對應資源。 The appropriate resources are loaded according to `VITE_TEMPLATE` at runtime.