Skip to content

fix: report a file's errors once, on the module that compiled it - #1760

Merged
johnnyreilly merged 7 commits into
nextfrom
ccr-4cddec7b-7yznjj-1745-errors-twice
Dec 1, 2026
Merged

johnnyreilly merged 7 commits into
nextfrom
ccr-4cddec7b-7yznjj-1745-errors-twice

Conversation

@johnnyreilly

@johnnyreilly johnnyreilly commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Fixes #1745 and #1746, which have the same cause.

The cause

ts-loader kept a compiled file's errors under webpack's name for the file, and looked for the module to put them on by the name the errors are shown under. Neither is always the name TypeScript has for the file:

File webpack's name TypeScript's name
thing.custom, not matched by appendTsSuffixTo thing.custom thing.custom.ts
component.vue matched by appendTsSuffixTo (script) component.vue?vue&type=script&lang=ts component.vue.ts
component.vue (template) component.vue?vue&type=template&ts=true component.vue.template.ts

The fix

pendingDiagnostics is now keyed by TypeScript's name for the file, and each entry carries the resource of the module that compiled it (path and query). The errors are reported on that module, and the recheck and the clean-up of gone files find the module the same way (getPendingModuleKey). That removes the special case for blocks and FileLayer.block.displayFileName.

A restored module's file (added after the first push)

A file's stored errors are dropped while the file is in neither the build nor the program. 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, and 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, so its error was reported a second time on the compilation. The Windows comparison run of #1763, which is stacked on this branch, found it; vueScriptLeavesProgramWatch reproduces it on Linux.

  • The layer now records the module the file was compiled as (FileLayer.resource, displayFileName), so the recheck finds the module without stored errors (getCompiledFile).
  • Errors found by a recheck made while the module was out of the build are given the module when it is back (vueRecheckedWhileNotImportedWatch). Before, they were shown without the module or its import trace.

What changes for users

  • A file with no TypeScript extension has its errors reported once, and they go away when it is fixed.
  • A .vue template's errors are attached to the template's module (./component.vue?vue&type=template&ts=true), so webpack shows the module and its import trace with them, and they survive a persistent cache restore. The snapshots of vueBlockRemovedWatch and vueBlocksDeletedWatch change only in that way.

Tests

Both comparison and execution 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
@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 631.6 634.7 -0.5%
Incremental rebuild (leaf touch) false 53.3 53.3 +0.1%
Incremental rebuild (hub touch) false 215.2 216.5 -0.6%
Cold build true 372.1 378.3 -1.7%
Incremental rebuild (leaf touch) true 34.5 35.5 -2.8%
Incremental rebuild (hub touch) true 35.2 34.6 +1.6%
Cold build (all orphan files) false 714.6 698.9 +2.2%
Incremental rebuild (hub touch, all orphan files) false 248.4 246.4 +0.8%
Cold build (declaration) false 712.4 720.3 -1.1%
Incremental rebuild (leaf touch, declaration) false 92.6 91.8 +0.8%

PR branch = 8f6d0d5 merged into next, base branch = next at e71d6e0. 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 589.7 572.1 +3.1%
Incremental rebuild (leaf touch) false 84.7 89.7 -5.6%
Incremental rebuild (hub touch) false 201.4 205.4 -2.0%
Cold build true 380.2 398.9 -4.7%
Incremental rebuild (leaf touch) true 52.4 51.5 +1.8%
Incremental rebuild (hub touch) true 53.5 52.2 +2.5%
Cold build (all orphan files) false 653.2 655.5 -0.4%
Incremental rebuild (hub touch, all orphan files) false 287.9 288.2 -0.1%
Cold build (declaration) false 698.2 697.6 +0.1%
Incremental rebuild (leaf touch, declaration) false 131.9 127.6 +3.4%

PR branch = 8f6d0d5 merged into next, base branch = next at e71d6e0. 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 778.0 789.2 -1.4%
Incremental rebuild (leaf touch) false 63.0 62.9 +0.3%
Incremental rebuild (hub touch) false 263.7 258.7 +1.9%
Cold build true 428.2 436.2 -1.8%
Incremental rebuild (leaf touch) true 33.8 36.0 -6.0%
Incremental rebuild (hub touch) true 35.7 35.8 -0.2%
Cold build (all orphan files) false 814.1 803.8 +1.3%
Incremental rebuild (hub touch, all orphan files) false 292.2 285.1 +2.5%
Cold build (declaration) false 851.2 857.2 -0.7%
Incremental rebuild (leaf touch, declaration) false 270.9 265.4 +2.1%

PR branch = 8f6d0d5 merged into next, base branch = next at e71d6e0. 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.

…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
…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
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
…745-errors-twice

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

# Conflicts:
#	CHANGELOG.md
@johnnyreilly
johnnyreilly merged commit 4519f74 into next Dec 1, 2026
129 of 135 checks passed
@johnnyreilly
johnnyreilly deleted the ccr-4cddec7b-7yznjj-1745-errors-twice branch December 1, 2026 05:55
johnnyreilly added a commit that referenced this pull request Dec 1, 2026
* fix: report a file's errors once, on the module that compiled it

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

* docs: changelog for #1760

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

* test: don't depend on whether webpack trusts a just-changed file's cache 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

* fix: forget a block its .vue file no longer has, and treat a file's script 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

* docs: changelog for #1763

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

* fix: know a restored module's file when its stored errors have been dropped

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

* test: a file out of the build keeps its errors to itself in the new vue test

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

* test: keep the unimported script out of the new vue test

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

* test: one error in vueFileNotImportedWatch, so its output is the same on every platform

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
johnnyreilly added a commit that referenced this pull request Dec 1, 2026
)

* fix: report a file's errors once, on the module that compiled it

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

* docs: changelog for #1760

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

* test: don't depend on whether webpack trusts a just-changed file's cache 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

* fix: keep a real file apart from a file whose made-up name it has

For a file with no TypeScript extension, ts-loader makes up the name it
gives TypeScript: schema.graphql.ts for schema.graphql. A real file can
have that name. Two things went wrong then:

- When schema.graphql changed or was deleted, TypeScript was told that
  schema.graphql.ts had, whether or not ts-loader compiled
  schema.graphql. After a deletion the build could fail with "no project
  found for opened file". A made-up name is now only passed on while a
  layer has it.
- When ts-loader did compile schema.graphql, its text replaced the real
  file's for TypeScript, so importers of the real file were checked
  against the wrong text. The compiled file now gets another name
  (schema.graphql.ts-loader.ts) when a real file has the usual one.

Fixes #1750

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

* docs: changelog for #1764

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

* fix: know a restored module's file when its stored errors have been dropped

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

* test: keep the unimported script out of the new vue test

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

---------

Co-authored-by: Claude <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.

2 participants