Skip to content

fix: forget a block its .vue file no longer has - #1763

Merged
johnnyreilly merged 17 commits into
nextfrom
ccr-4cddec7b-7yznjj-1749-vue-block-gone
Dec 1, 2026
Merged

johnnyreilly merged 17 commits into
nextfrom
ccr-4cddec7b-7yznjj-1749-vue-block-gone

Conversation

@johnnyreilly

@johnnyreilly johnnyreilly commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Fixes #1749.

What changes

1. A block its file no longer has is forgotten. A .vue file's block other than the script (in practice the compiled template) has a TypeScript name of its own, component.vue.template.ts. When the file lost the block, it stayed a file of the program for the rest of the watch. forgetRemovedBlocks now drops the layer and hides the name from TypeScript, using the rule the issue proposes: the module of the file itself (vue-loader's, whose resource has no query) was built in this compilation, and no module asks for the block. "Built" is read from the compilation (builtModules), not from changedFilesThisBuild. It runs before the end-of-build recheck, so TypeScript is told in the same build.

A block whose file is merely out of the build is kept, as before: webpack can bring its module back from its cache without running the loaders.

2. A file's script and template are treated alike while the file is out of the build. Before, the template's errors were held back and the script's were still reported. Now neither is reported. With #1760 each stored error set knows the module resource it was compiled as, so the rule no longer needs a list of blocks: errors of a file compiled under a name ts-loader made up are held back while no module has that resource. I chose "neither" over "both" because TypeScript only has the text ts-loader last gave it for such a file, and nothing keeps that up to date while the module is out of the build.

This also applies to other made-up names: a thing.custom file compiled by ts-loader that nothing imports any more stops reporting its errors until it is imported again. A file with a TypeScript extension is not affected: it is a project file that TypeScript reads itself, and its errors are reported as before.

getUnrequestedBlocks is replaced by forgetRemovedBlocks; the reporting code no longer takes a list from it.

Against the issue's "done when"

  • A removed block is no longer in the program after the build that compiled the file without it: vueBlockGoneWatch. other.ts imports a type from ./component.vue.template; when component.vue loses its template, other.ts reports TS2307 in that build. Without the change it never does.
  • vueBlockRemovedWatch passes unchanged.
  • Script and template alike: vueFileNotImportedWatch. The script has an error; it is not reported while app.ts doesn't import the file, as a template's isn't (vueBlockRemovedWatch), and comes back when it does. Without the change it is still reported in between, on Linux and macOS. On Windows the script leaves the program when nothing imports it, so the error went there already; that difference is why the test has one error and not two, whose order would differ.

Not done: with custom blocks, removing one shifts the indexes of the rest. The last index is then unrequested and is forgotten by the rule above, and the others are compiled again under their new indexes, so I believe this case is covered, but there is no test for it.

Both test packs pass locally.

https://claude.ai/code/session_01Q2Jv7JZWr3VUxCkXiKB5e5


Generated by Claude Code

ts-loader kept a compiled file's errors under webpack's name for it and
looked for its module under the name the errors are shown by. Where
those are not the name TypeScript has, two things went wrong:

- A file with no TypeScript extension that appendTsSuffixTo doesn't
  match was taken by the end-of-build recheck as never checked, so its
  errors were reported a second time under the made-up name, and that
  copy stayed after the file was fixed.
- The errors of a .vue file's template went on the compilation only,
  and those of a script matched by appendTsSuffixTo on no module either,
  so they were lost when the module was restored from webpack's
  persistent cache.

The errors are now kept under TypeScript's name, with the resource of
the module that compiled the file, and are reported on that module.

Fixes #1745
Fixes #1746

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2Jv7JZWr3VUxCkXiKB5e5
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2Jv7JZWr3VUxCkXiKB5e5
…che entry

vueBlocksPersistentCache changed other.js in patch0 and expected it to be
restored from the cache in patch1. webpack doesn't trust the cache for a
file changed that close to the build, so whether it was restored came
down to timing. patch1 now changes the file again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2Jv7JZWr3VUxCkXiKB5e5
…cript and template alike

A block other than the script that a .vue file loses (in practice its
compiled template) stayed a file of the TypeScript program for the rest
of the watch: nothing compiles it again and nothing says it has gone.
It is now forgotten, and hidden from TypeScript, in the build that
compiles the file without it: the module of the file itself was built
and no module asks for the block. A block whose file is merely out of
the build is kept as before.

While a .vue file is out of the build, the errors of its template were
held back and those of its script were still reported. Neither is
reported now: both are text that ts-loader gave TypeScript and that
nothing keeps up to date. The same goes for any file compiled under a
name ts-loader made up.

Fixes #1749

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2Jv7JZWr3VUxCkXiKB5e5
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2Jv7JZWr3VUxCkXiKB5e5
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Benchmark (Ubuntu)

Scenario transpileOnly PR branch median (ms) base branch median (ms) Δ vs base branch
Cold build false 363.5 363.9 -0.1%
Incremental rebuild (leaf touch) false 33.3 33.7 -0.9%
Incremental rebuild (hub touch) false 121.2 121.2 +0.0%
Cold build true 219.9 227.2 -3.2%
Incremental rebuild (leaf touch) true 21.3 21.5 -0.9%
Incremental rebuild (hub touch) true 22.9 22.8 +0.3%
Cold build (all orphan files) false 398.0 398.6 -0.2%
Incremental rebuild (hub touch, all orphan files) false 138.2 138.5 -0.2%
Cold build (declaration) false 396.6 394.7 +0.5%
Incremental rebuild (leaf touch, declaration) false 52.7 53.3 -1.0%

PR branch = c438368 merged into next, base branch = next at 4519f74. Each row is the median of up to 60 cold builds, or up to 200 rebuilds, after 2 warmup iterations. Report-only - no threshold fails this check.

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Benchmark (Windows)

Scenario transpileOnly PR branch median (ms) base branch median (ms) Δ vs base branch
Cold build false 709.9 719.3 -1.3%
Incremental rebuild (leaf touch) false 51.4 47.8 +7.5%
Incremental rebuild (hub touch) false 237.7 240.9 -1.3%
Cold build true 451.4 445.2 +1.4%
Incremental rebuild (leaf touch) true 34.3 33.9 +1.1%
Incremental rebuild (hub touch) true 36.5 32.3 +13.0%
Cold build (all orphan files) false 834.0 822.6 +1.4%
Incremental rebuild (hub touch, all orphan files) false 313.9 314.4 -0.2%
Cold build (declaration) false 887.9 876.3 +1.3%
Incremental rebuild (leaf touch, declaration) false 257.7 258.3 -0.2%

PR branch = c438368 merged into next, base branch = next at 4519f74. Each row is the median of up to 60 cold builds, or up to 200 rebuilds, after 2 warmup iterations. Report-only - no threshold fails this check.

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Benchmark (macOS)

Scenario transpileOnly PR branch median (ms) base branch median (ms) Δ vs base branch
Cold build false 497.5 496.8 +0.1%
Incremental rebuild (leaf touch) false 54.1 54.8 -1.3%
Incremental rebuild (hub touch) false 159.3 160.6 -0.8%
Cold build true 262.7 253.6 +3.6%
Incremental rebuild (leaf touch) true 51.8 51.2 +1.3%
Incremental rebuild (hub touch) true 51.4 52.2 -1.5%
Cold build (all orphan files) false 570.2 616.5 -7.5%
Incremental rebuild (hub touch, all orphan files) false 217.7 209.7 +3.8%
Cold build (declaration) false 462.0 443.7 +4.1%
Incremental rebuild (leaf touch, declaration) false 94.3 87.2 +8.2%

PR branch = c438368 merged into next, base branch = next at 4519f74. Each row is the median of up to 60 cold builds, or up to 200 rebuilds, after 2 warmup iterations. Report-only - no threshold fails this check.

…ropped

A file's stored errors are dropped while the file is in neither the
build nor the program, and with them went the only record of which
module had compiled it. A .vue file's script is in that position when
nothing imports the file and the tsconfig doesn't include it (on
Windows, also when it does). When the file was imported again, webpack
brought the module back from its cache, and the recheck took the script
for a file with no module: its error was reported a second time, on the
compilation.

The layer now records the module the file was compiled as, so the
recheck finds it without stored errors. And errors found by a recheck
made while the module was out of the build are given the module when it
is back.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2Jv7JZWr3VUxCkXiKB5e5
…ue test

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2Jv7JZWr3VUxCkXiKB5e5
Whether a .vue file's script stays in the program while nothing imports
it differs between platforms, so its error was reported in patch0 on
Linux and not on Windows. Only the template has an error now.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2Jv7JZWr3VUxCkXiKB5e5
… on every platform

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2Jv7JZWr3VUxCkXiKB5e5
…745-errors-twice

# Conflicts:
#	CHANGELOG.md
#	test/comparison-tests/create-and-execute-test.js
…745-errors-twice

# Conflicts:
#	CHANGELOG.md
…749-vue-block-gone

# Conflicts:
#	CHANGELOG.md
#	src/diagnostics.ts
@johnnyreilly
johnnyreilly marked this pull request as ready for review December 1, 2026 06:05
@johnnyreilly
johnnyreilly merged commit 123a5f8 into next Dec 1, 2026
45 checks passed
@johnnyreilly
johnnyreilly deleted the ccr-4cddec7b-7yznjj-1749-vue-block-gone branch December 1, 2026 06:19
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.

2 participants