Skip to content

fix(swc): do not inherit watch mode when transpiling newly added files - #3483

Open
higuaifan wants to merge 1 commit into
nestjs:masterfrom
higuaifan:fix-swc-added-file-watch-inherit
Open

fix(swc): do not inherit watch mode when transpiling newly added files#3483
higuaifan wants to merge 1 commit into
nestjs:masterfrom
higuaifan:fix-swc-added-file-watch-inherit

Conversation

@higuaifan

Copy link
Copy Markdown

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

The "transpile newly added file" callback in the swc builder re-invokes swcCli.default() with watch: true inherited from the outer options. Per added file (renames and git checkouts count — atomic writes surface as add), this registers one more permanent chokidar watcher inside @swc/cli (stacked watchers → duplicate compiles and back-to-back restarts) and constructs one more Piscina worker pool that @swc/cli never destroys (swc-project/pkgs#126) — a week-long watch session accumulated ~1,700 idle worker threads / ~15 GB.

Issue Number: #3482

What is the new behavior?

The added-file invocation is one-shot: watch: false stops the watcher stacking, and sync: true skips spawning a worker pool to transpile a single file. Unit test added.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

This PR — investigation, patch, test, and local CI verification — was engineered by Claude; I'm following up and available for changes if wanted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant