Skip to content

Commit a5d2003

Browse files
authored
fix(js): update outDir in runtime tsconfig files to match types export in package.json (#30217)
## Current Behavior In the TS solution setup, several project generators produce the runtime tsconfig files (e.g. `tsconfig.lib.json`) with the `outDir` set to `out-tsc/<project name>`. This causes issues with the inferred `typecheck` task because the project `package.json` has the `types` export pointing to `dist/...`, which wouldn't be produced by `typecheck`. ## Expected Behavior In the TS solution setup, project generators should produce the runtime tsconfig files (e.g. `tsconfig.lib.json`) with the `outDir` set to a path (`dist`) that matches the value in the project `package.json`'s `types` export. ## Related Issue(s) Fixes #
1 parent b992e25 commit a5d2003

File tree

19 files changed

+35
-40
lines changed

19 files changed

+35
-40
lines changed

packages/expo/src/generators/application/application.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,9 @@ describe('app', () => {
400400
"module": "esnext",
401401
"moduleResolution": "bundler",
402402
"noUnusedLocals": false,
403-
"outDir": "out-tsc/my-app",
403+
"outDir": "dist",
404404
"rootDir": "src",
405-
"tsBuildInfoFile": "out-tsc/my-app/tsconfig.app.tsbuildinfo",
405+
"tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo",
406406
"types": [
407407
"node",
408408
],

packages/expo/src/generators/library/library.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,9 @@ describe('lib', () => {
552552
"jsx": "react-jsx",
553553
"module": "esnext",
554554
"moduleResolution": "bundler",
555-
"outDir": "out-tsc/my-lib",
555+
"outDir": "dist",
556556
"rootDir": "src",
557-
"tsBuildInfoFile": "out-tsc/my-lib/tsconfig.lib.tsbuildinfo",
557+
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
558558
"types": [
559559
"node",
560560
],

packages/express/src/generators/application/application.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ describe('app', () => {
265265
"compilerOptions": {
266266
"module": "nodenext",
267267
"moduleResolution": "nodenext",
268-
"outDir": "out-tsc/myapp",
268+
"outDir": "dist",
269269
"rootDir": "src",
270-
"tsBuildInfoFile": "out-tsc/myapp/tsconfig.app.tsbuildinfo",
270+
"tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo",
271271
"types": [
272272
"node",
273273
"express",

packages/js/src/generators/library/library.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,10 +1031,7 @@ function createProjectTsConfigs(
10311031
.map(([k, v]) => `${JSON.stringify(k)}: ${JSON.stringify(v)}`)
10321032
.join(',\n '),
10331033
tmpl: '',
1034-
outDir:
1035-
options.bundler === 'tsc'
1036-
? 'dist'
1037-
: `out-tsc/${options.projectRoot.split('/').pop()}`,
1034+
outDir: 'dist',
10381035
emitDeclarationOnly: options.bundler === 'tsc' ? false : true,
10391036
}
10401037
);

packages/js/src/utils/typescript/ts-solution-setup.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,7 @@ export function updateTsconfigFiles(
140140

141141
json.compilerOptions = {
142142
...json.compilerOptions,
143-
// Make sure d.ts files from typecheck does not conflict with bundlers.
144-
// Other tooling like jest write to "out-tsc/jest" to we just default to "out-tsc/<project-name>".
145-
outDir: joinPathFragments('out-tsc', projectRoot.split('/').at(-1)),
143+
outDir: 'dist',
146144
rootDir,
147145
...compilerOptions,
148146
};

packages/nest/src/generators/application/application.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ describe('application generator', () => {
281281
"experimentalDecorators": true,
282282
"module": "nodenext",
283283
"moduleResolution": "nodenext",
284-
"outDir": "out-tsc/myapp",
284+
"outDir": "dist",
285285
"rootDir": "src",
286286
"target": "es2021",
287-
"tsBuildInfoFile": "out-tsc/myapp/tsconfig.app.tsbuildinfo",
287+
"tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo",
288288
"types": [
289289
"node",
290290
],

packages/next/src/generators/application/application.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ describe('app (legacy)', () => {
981981
"module": "esnext",
982982
"moduleResolution": "bundler",
983983
"noEmit": true,
984-
"outDir": "out-tsc/myapp",
984+
"outDir": "dist",
985985
"paths": {
986986
"@/*": [
987987
"./src/*",
@@ -995,7 +995,7 @@ describe('app (legacy)', () => {
995995
"resolveJsonModule": true,
996996
"rootDir": "src",
997997
"strict": true,
998-
"tsBuildInfoFile": "out-tsc/myapp/tsconfig.tsbuildinfo",
998+
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo",
999999
"types": [
10001000
"jest",
10011001
"node",

packages/next/src/generators/library/library.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ describe('next library', () => {
187187
"jsx": "react-jsx",
188188
"module": "esnext",
189189
"moduleResolution": "bundler",
190-
"outDir": "out-tsc/mylib",
190+
"outDir": "dist",
191191
"rootDir": "src",
192-
"tsBuildInfoFile": "out-tsc/mylib/tsconfig.lib.tsbuildinfo",
192+
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
193193
"types": [
194194
"node",
195195
"@nx/react/typings/cssmodule.d.ts",

packages/node/src/generators/application/application.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,9 @@ describe('app', () => {
667667
"compilerOptions": {
668668
"module": "nodenext",
669669
"moduleResolution": "nodenext",
670-
"outDir": "out-tsc/myapp",
670+
"outDir": "dist",
671671
"rootDir": "src",
672-
"tsBuildInfoFile": "out-tsc/myapp/tsconfig.app.tsbuildinfo",
672+
"tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo",
673673
"types": [
674674
"node",
675675
],

packages/nuxt/src/generators/application/application.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,10 @@ describe('app', () => {
286286
"jsxImportSource": "vue",
287287
"module": "esnext",
288288
"moduleResolution": "bundler",
289-
"outDir": "out-tsc/myapp",
289+
"outDir": "dist",
290290
"resolveJsonModule": true,
291291
"rootDir": "src",
292-
"tsBuildInfoFile": "out-tsc/myapp/tsconfig.app.tsbuildinfo",
292+
"tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo",
293293
},
294294
"exclude": [
295295
"out-tsc",

0 commit comments

Comments
 (0)