packages/js/src/migrations/update-22-1-0/remove-redundant-ts-project-references.md
Removes redundant TypeScript project references from tsconfig.json files when runtime tsconfig files (e.g., tsconfig.lib.json, tsconfig.app.json) exist. Previously, external project references were duplicated in both the project's tsconfig.json and runtime tsconfig files. This migration syncs the TypeScript project references to match the project graph, ensuring that external references only appear in runtime tsconfig files when they exist.
When a project has runtime tsconfig files like tsconfig.lib.json, the migration will remove external project references from the project's tsconfig.json file:
// libs/my-lib/tsconfig.json
{
"compilerOptions": {
"composite": true,
},
"references": [
{
"path": "../other-lib",
},
],
}
// libs/my-lib/tsconfig.json
{
"compilerOptions": {
"composite": true,
},
"references": [],
}
The external references remain in the runtime tsconfig file where they belong:
// libs/my-lib/tsconfig.lib.json
{
"compilerOptions": {
"composite": true,
},
"references": [
{
"path": "../other-lib/tsconfig.lib.json",
},
],
}
// libs/my-lib/tsconfig.lib.json
{
"compilerOptions": {
"composite": true,
},
"references": [
{
"path": "../other-lib/tsconfig.lib.json",
},
],
}
For projects without runtime tsconfig files, the project's tsconfig.json file will continue to contain external project references:
// libs/legacy-lib/tsconfig.json
{
"compilerOptions": {
"composite": true,
},
"references": [
{
"path": "../other-lib",
},
],
}
// libs/legacy-lib/tsconfig.json
{
"compilerOptions": {
"composite": true,
},
"references": [
{
"path": "../other-lib",
},
],
}
Internal project references (references within the same project directory) are preserved in the project's tsconfig.json:
// libs/my-lib/tsconfig.json
{
"compilerOptions": {
"composite": true,
},
"references": [
{
"path": "./tsconfig.lib.json",
},
{
"path": "./tsconfig.spec.json",
},
],
}
// libs/my-lib/tsconfig.json
{
"compilerOptions": {
"composite": true,
},
"references": [
{
"path": "./tsconfig.lib.json",
},
{
"path": "./tsconfig.spec.json",
},
],
}