Commit f048aa96 by luoqi

build: 修 nest deleteOutDir+incremental 导致 dist 残缺(tsbuildinfo)

nest-cli deleteOutDir 删 dist 后,base 的 incremental:true 留下的 *.tsbuildinfo
让 tsc 误判"已构建"跳过 emit → dist 缺 config 等 → 启动 Cannot find module
(nest-cli#3312 / typescript-starter#186)。

- apps/pac-service 新增 tsconfig.build.json(incremental:false,nest build 默认优先用它);
  IDE 仍用 tsconfig.json 保留 incremental
- packages/types|utils 关 incremental(叶子包,类型检查瞬时)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
parent 19be1c41
{
// nest build 默认优先用本文件(存在即用,否则回退 tsconfig.json)。
//
// 为什么单独一份:构建侧关掉 incremental。
// 根因(nest-cli #3312 / typescript-starter #186):nest-cli.json `deleteOutDir:true` 每次构建先删 dist,
// base 配置的 `incremental:true` 留下的 `*.tsbuildinfo` 仍在 tsc 据缓存判定"全部已构建" 跳过 emit
// 被删掉的文件 启动时 `Cannot find module './config/configuration'`(dist 残缺)。
// 关掉 incremental tsc 不读/写 tsbuildinfo 每次全量 emit,deleteOutDir 再也不会留残缺 dist。
//
// 编辑器/类型检查仍走 tsconfig.json(保留 base incremental,IDE 体验不变),两者互不影响。
"extends": "./tsconfig.json",
"compilerOptions": {
"incremental": false
},
"exclude": ["node_modules", "dist", "test", "tests", "**/*.spec.ts"]
}
...@@ -7,7 +7,11 @@ ...@@ -7,7 +7,11 @@
"rootDir": "./src", "rootDir": "./src",
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"sourceMap": true "sourceMap": true,
// 构建稳定性:关掉 base 继承的 incremental 不写 *.tsbuildinfo,每次全量 emit。
// 否则手动删 dist 后再 tsc,tsbuildinfo 缓存会让 tsc 误判"已构建"跳过 emit dist 残缺
// (同 nest-cli#3312 / typescript-starter#186)。叶子包类型检查瞬时, incremental 零成本。
"incremental": false
}, },
"include": ["src/**/*"] "include": ["src/**/*"]
} }
...@@ -9,7 +9,11 @@ ...@@ -9,7 +9,11 @@
"declarationMap": true, "declarationMap": true,
"sourceMap": true, "sourceMap": true,
"lib": ["ES2022"], "lib": ["ES2022"],
"types": ["node"] "types": ["node"],
// 构建稳定性:关掉 base 继承的 incremental 不写 *.tsbuildinfo,每次全量 emit。
// 否则手动删 dist 后再 tsc,tsbuildinfo 缓存会让 tsc 误判"已构建"跳过 emit dist 残缺
// (同 nest-cli#3312 / typescript-starter#186)。叶子包类型检查瞬时, incremental 零成本。
"incremental": false
}, },
"include": ["src/**/*"] "include": ["src/**/*"]
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment