Repository navigation
fix(compiler): fork the swc type checker with the application's plugins - #3596
Merged
kamilmysliwiec merged 1 commit intoSep 25, 2026
Merged
Conversation
In watch mode with --type-check, the swc compiler forks the type checker with the root "compilerOptions.plugins" only. In a monorepo an application can declare its own plugins under "projects.<app>.compilerOptions.plugins", and the non-watch path already loads them per application through loadPlugins(), so `nest build api --builder swc --type-check` generated the CLI plugin metadata while `nest start api --builder swc --type-check --watch` reported "Found 0 issues" and generated none. Resolve the plugins through getValueOrDefault with the application name, the same way nestjs#3589 did for "sourceRoot" one argument above.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
PR Type
What is the current behavior?
Issue Number: N/A
In watch mode with
--type-check, the swc compiler forksforked-type-checkerwith the rootcompilerOptions.pluginsonly:In a monorepo an application can declare its own plugins under
projects.<app>.compilerOptions.plugins, and the non-watch path already loads them per application throughloadPlugins()(which resolvescompilerOptions.pluginswithgetValueOrDefault(..., appName)). So with{ "projects": { "api": { "compilerOptions": { "plugins": ["@nestjs/swagger"] } } } }and no root plugins,
nest build api --builder swc --type-checkgenerates the swagger metadata, whilenest start api --builder swc --type-check --watchprints "Found 0 issues" and generates none. The forked checker places whatever it receives underprojects[app], so the application's own plugins are lost for good.#3589 fixed the same class of problem for
sourceRootin these same fork arguments; the plugins argument one line below was missed.What is the new behavior?
The plugins are resolved through
getValueOrDefault(configuration, 'compilerOptions.plugins', appName), matching the non-watch path and thesourceRootargument.The existing "should fork the type checker with the built application source root" spec now declares per-application plugins and asserts they reach the forked checker. It fails on
masterand passes with this change.Does this PR introduce a breaking change?