Support --stopBuildOnErrors CLI Flag for @nx/js/typescript plugin #33517
Csszabi98
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Typescript 5.6 introduced a new default behavior related to how typescript builds downstream projects when an upstream project build fails (Typescript 5.6 Allow --build with Intermediate Errors). The release also added a new CLI flag (
--stopBuildOnErrors) which can be used together with--build, to replicate the default behavior from prior versions, which as the article describes is still useful in some cases (i.e.: for tightly coupled projects or CI environments).Problem statement
Since NX encourages tsconfig project reference based setups, and these involve creating a dedicated
tsconfig.spec.json, file for each project with tests, this flag can be extremely useful since if thetsconfig.lib.jsonbased build fails,tsconfig.spec.jsonwill start to produce a lot oferror TS6305: Output file 'test-dependency.d.ts' has not been built from source fileerrors.Proposed changes
Considering the default settings of
@nx/js/typescriptplugin innx.json:It would be ideal to shortcurcuit per package typecheck/build jobs as well by default, not just the cross package typecheck/build jobs, while keeping this configurable for anyone who wants a different behavior who is on Typescript 5.6+ (anyone below that version already gets the proposed behavior).
Thus I propose to add a new
stopBuildOnErrorsoption for both thetypecheckand thebuildoptions interface, while setting the default value to:truefortypechecktrueforbuildThe option should be ignored for projects running with <Typescript 5.6, since the CLI flag is not supported below that version.
Individual repositories could still build with errors while setting
stopBuildOnErrorstofalse, and removingdependsOnfrom the plugintargetDefaults.Additional considerations
The noEmitOnError tsconfig option could be used to drive this behavior (false by default), but that would add a lot of extra complexity involving tsconfig parsing and potential extends clause resolution, also separate build jobs for each tsconfig with a different value set, so it is probably overkill.
Beta Was this translation helpful? Give feedback.
All reactions