File tree 13 files changed +47
-14
lines changed
esbuild/src/executors/esbuild
webpack/src/plugins/nx-webpack-plugin/lib
13 files changed +47
-14
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,10 @@ export async function* esbuildExecutor(
133
133
name : 'nx-watch-plugin' ,
134
134
setup ( build : esbuild . PluginBuild ) {
135
135
build . onEnd ( async ( result : esbuild . BuildResult ) => {
136
- if ( ! options . skipTypeCheck ) {
136
+ if (
137
+ ! options . skipTypeCheck &&
138
+ ! options . isTsSolutionSetup
139
+ ) {
137
140
const { errors } = await runTypeCheck (
138
141
options ,
139
142
context
@@ -180,7 +183,7 @@ export async function* esbuildExecutor(
180
183
) ;
181
184
} else {
182
185
// Run type-checks first and bail if they don't pass.
183
- if ( ! options . skipTypeCheck ) {
186
+ if ( ! options . skipTypeCheck && ! options . isTsSolutionSetup ) {
184
187
const { errors } = await runTypeCheck ( options , context ) ;
185
188
if ( errors . length > 0 ) {
186
189
yield { success : false } ;
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ describe('normalizeOptions', () => {
66
66
singleEntry : true ,
67
67
external : [ ] ,
68
68
thirdParty : false ,
69
+ isTsSolutionSetup : false ,
69
70
} ) ;
70
71
} ) ;
71
72
@@ -93,6 +94,7 @@ describe('normalizeOptions', () => {
93
94
singleEntry : false ,
94
95
external : [ ] ,
95
96
thirdParty : false ,
97
+ isTsSolutionSetup : false ,
96
98
} ) ;
97
99
} ) ;
98
100
@@ -119,6 +121,7 @@ describe('normalizeOptions', () => {
119
121
singleEntry : true ,
120
122
external : [ ] ,
121
123
thirdParty : false ,
124
+ isTsSolutionSetup : false ,
122
125
} ) ;
123
126
} ) ;
124
127
@@ -162,6 +165,7 @@ describe('normalizeOptions', () => {
162
165
singleEntry : true ,
163
166
external : [ ] ,
164
167
thirdParty : false ,
168
+ isTsSolutionSetup : false ,
165
169
} ) ;
166
170
} ) ;
167
171
Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ export function normalizeOptions(
110
110
userDefinedBuildOptions,
111
111
external : options . external ?? [ ] ,
112
112
singleEntry : false ,
113
+ isTsSolutionSetup,
113
114
// Use the `main` file name as the output file name.
114
115
// This is needed for `@nx/js:node` to know the main file to execute.
115
116
// NOTE: The .js default extension may be replaced later in getOutfile() call.
@@ -126,6 +127,7 @@ export function normalizeOptions(
126
127
userDefinedBuildOptions,
127
128
external : options . external ?? [ ] ,
128
129
singleEntry : true ,
130
+ isTsSolutionSetup,
129
131
outputFileName :
130
132
// NOTE: The .js default extension may be replaced later in getOutfile() call.
131
133
options . outputFileName ?? `${ path . parse ( options . main ) . name } .js` ,
Original file line number Diff line number Diff line change @@ -36,4 +36,5 @@ export interface NormalizedEsBuildExecutorOptions
36
36
singleEntry : boolean ;
37
37
external : string [ ] ;
38
38
userDefinedBuildOptions : esbuild . BuildOptions | undefined ;
39
+ isTsSolutionSetup ?: boolean ;
39
40
}
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ function normalizeOptions(
56
56
57
57
const outputPath = join ( root , options . outputPath ) ;
58
58
59
- if ( options . skipTypeCheck == null ) {
59
+ if ( options . skipTypeCheck == null && ! isTsSolutionSetup ) {
60
60
options . skipTypeCheck = false ;
61
61
}
62
62
Original file line number Diff line number Diff line change @@ -297,7 +297,10 @@ async function configureProject(
297
297
projectConfiguration . targets . build . options . format = [ 'cjs' ] ;
298
298
}
299
299
300
- if ( options . bundler === 'swc' && options . skipTypeCheck ) {
300
+ if (
301
+ options . bundler === 'swc' &&
302
+ ( options . skipTypeCheck || options . isUsingTsSolutionConfig )
303
+ ) {
301
304
projectConfiguration . targets . build . options . skipTypeCheck = true ;
302
305
}
303
306
@@ -783,7 +786,7 @@ async function normalizeOptions(
783
786
784
787
if (
785
788
( options . bundler === 'swc' || options . bundler === 'rollup' ) &&
786
- options . skipTypeCheck == null
789
+ ( options . skipTypeCheck == null || ! isUsingTsSolutionConfig )
787
790
) {
788
791
options . skipTypeCheck = false ;
789
792
}
Original file line number Diff line number Diff line change @@ -51,8 +51,11 @@ export function isWorkspacesEnabled(
51
51
}
52
52
53
53
// yarn and npm both use the same 'workspaces' property in package.json
54
- const packageJson = readJson < PackageJson > ( tree , 'package.json' ) ;
55
- return ! ! packageJson ?. workspaces ;
54
+ if ( tree . exists ( 'package.json' ) ) {
55
+ const packageJson = readJson < PackageJson > ( tree , 'package.json' ) ;
56
+ return ! ! packageJson ?. workspaces ;
57
+ }
58
+ return false ;
56
59
}
57
60
58
61
export function getProjectPackageManagerWorkspaceStateWarningTask (
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ export async function compileSwc(
90
90
logger . log ( swcCmdLog . replace ( / \n / , '' ) ) ;
91
91
const isCompileSuccess = swcCmdLog . includes ( 'Successfully compiled' ) ;
92
92
93
- if ( normalizedOptions . skipTypeCheck ) {
93
+ if ( normalizedOptions . skipTypeCheck || normalizedOptions . isTsSolutionSetup ) {
94
94
await postCompilationCallback ( ) ;
95
95
return { success : isCompileSuccess } ;
96
96
}
@@ -159,7 +159,10 @@ export async function* compileSwcWatch(
159
159
initialPostCompile = false ;
160
160
}
161
161
162
- if ( normalizedOptions . skipTypeCheck ) {
162
+ if (
163
+ normalizedOptions . skipTypeCheck ||
164
+ normalizedOptions . isTsSolutionSetup
165
+ ) {
163
166
next ( getResult ( swcStatus ) ) ;
164
167
return ;
165
168
}
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { resolve } from 'path';
2
2
import { ExecutorContext } from '@nx/devkit' ;
3
3
4
4
import type { RollupExecutorOptions } from '../schema' ;
5
+ import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup' ;
5
6
6
7
export interface NormalizedRollupExecutorOptions extends RollupExecutorOptions {
7
8
projectRoot : string ;
@@ -13,14 +14,15 @@ export function normalizeRollupExecutorOptions(
13
14
context : ExecutorContext
14
15
) : NormalizedRollupExecutorOptions {
15
16
const { root } = context ;
17
+ const skipTypeCheck = isUsingTsSolutionSetup ( ) ? true : options . skipTypeCheck ;
16
18
return {
17
19
...options ,
18
20
rollupConfig : [ ]
19
21
. concat ( options . rollupConfig )
20
22
. filter ( Boolean )
21
23
. map ( ( p ) => normalizePluginPath ( p , root ) ) ,
22
24
projectRoot : context . projectGraph . nodes [ context . projectName ] . data . root ,
23
- skipTypeCheck : options . skipTypeCheck || false ,
25
+ skipTypeCheck : skipTypeCheck || false ,
24
26
} ;
25
27
}
26
28
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import type {
7
7
RollupWithNxPluginOptions ,
8
8
} from './with-nx-options' ;
9
9
import { createEntryPoints } from '@nx/js' ;
10
+ import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup' ;
10
11
11
12
export function normalizeOptions (
12
13
projectRoot : string ,
@@ -16,6 +17,12 @@ export function normalizeOptions(
16
17
if ( global . NX_GRAPH_CREATION )
17
18
return options as NormalizedRollupWithNxPluginOptions ;
18
19
normalizeRelativePaths ( projectRoot , options ) ;
20
+
21
+ // New TS Solution already has a typecheck target
22
+ if ( isUsingTsSolutionSetup ( ) ) {
23
+ options . skipTypeCheck = true ;
24
+ }
25
+
19
26
return {
20
27
...options ,
21
28
additionalEntryPoints : createEntryPoints (
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { NxTsconfigPathsRspackPlugin } from './plugins/nx-tsconfig-paths-rspack-
18
18
import { getTerserEcmaVersion } from './get-terser-ecma-version' ;
19
19
import nodeExternals = require( 'webpack-node-externals' ) ;
20
20
import { NormalizedNxAppRspackPluginOptions } from './models' ;
21
+ import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup' ;
21
22
22
23
const IGNORED_RSPACK_WARNINGS = [
23
24
/ T h e c o m m e n t f i l e / i,
@@ -226,7 +227,8 @@ function applyNxDependentConfig(
226
227
227
228
plugins . push ( new NxTsconfigPathsRspackPlugin ( { ...options , tsConfig } ) ) ;
228
229
229
- if ( ! options ?. skipTypeChecking ) {
230
+ // New TS Solution already has a typecheck target
231
+ if ( ! options ?. skipTypeChecking && ! isUsingTsSolutionSetup ( ) ) {
230
232
const ForkTsCheckerWebpackPlugin = require ( 'fork-ts-checker-webpack-plugin' ) ;
231
233
plugins . push (
232
234
new ForkTsCheckerWebpackPlugin ( {
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import {
27
27
validateTypes ,
28
28
} from '../../utils/executor-utils' ;
29
29
import { type Plugin } from 'vite' ;
30
+ import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup' ;
30
31
31
32
export async function * viteBuildExecutor (
32
33
options : Record < string , any > & ViteBuildExecutorOptions ,
@@ -85,8 +86,8 @@ export async function* viteBuildExecutor(
85
86
...otherOptions ,
86
87
}
87
88
) ;
88
-
89
- if ( ! options . skipTypeCheck ) {
89
+ // New TS Solution already has a typecheck target
90
+ if ( ! options . skipTypeCheck && ! isUsingTsSolutionSetup ( ) ) {
90
91
await validateTypes ( {
91
92
workspaceRoot : context . root ,
92
93
tsconfig : tsConfigForBuild ,
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import { createLoaderFromCompiler } from './compiler-loaders';
19
19
import { NormalizedNxAppWebpackPluginOptions } from '../nx-app-webpack-plugin-options' ;
20
20
import TerserPlugin = require( 'terser-webpack-plugin' ) ;
21
21
import nodeExternals = require( 'webpack-node-externals' ) ;
22
+ import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup' ;
22
23
23
24
const IGNORED_WEBPACK_WARNINGS = [
24
25
/ T h e c o m m e n t f i l e / i,
@@ -232,7 +233,8 @@ function applyNxDependentConfig(
232
233
233
234
plugins . push ( new NxTsconfigPathsWebpackPlugin ( { ...options , tsConfig } ) ) ;
234
235
235
- if ( ! options ?. skipTypeChecking ) {
236
+ // New TS Solution already has a typecheck target
237
+ if ( ! options ?. skipTypeChecking && ! isUsingTsSolutionSetup ( ) ) {
236
238
const ForkTsCheckerWebpackPlugin = require ( 'fork-ts-checker-webpack-plugin' ) ;
237
239
plugins . push (
238
240
new ForkTsCheckerWebpackPlugin ( {
You can’t perform that action at this time.
0 commit comments