From 5aa09b05db721805c07bcde804455313d6c350de Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Fri, 13 Dec 2024 19:01:50 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=87=8F=E5=B0=91=20tsc=20noEmit=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=A1=AC=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .husky/pre-commit | 2 +- package.json | 4 ++-- tsconfig.json | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index aebedb1e..9acaa304 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ # 全局 ts 类型检查(此操作会增加 git commit 时长) -npx vue-tsc --noEmit +npx vue-tsc # 执行 lint-staged 中配置的任务 npx lint-staged diff --git a/package.json b/package.json index 1810c60c..6907dcff 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "repository": "https://github.com/un-pany/v3-admin-vite", "scripts": { "dev": "vite", - "build:staging": "vue-tsc --noEmit && vite build --mode staging", - "build": "vue-tsc --noEmit && vite build", + "build:staging": "vue-tsc && vite build --mode staging", + "build": "vue-tsc && vite build", "preview": "vite preview", "lint": "eslint . --fix", "prepare": "husky", diff --git a/tsconfig.json b/tsconfig.json index e782d967..d5520600 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,11 +23,15 @@ }, "resolveJsonModule": true, "types": ["vite/client", "element-plus/global"], + // 允许导入 .ts .mts .tsx 拓展名的文件 + "allowImportingTsExtensions": true, // 允许 JS "allowJs": true, // TS 严格模式 "strict": true, "importHelpers": true, + // 不输出任何编译后的文件,只进行类型检查 + "noEmit": true, "sourceMap": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true,