Repository navigation
fix: report a file's errors once, on the module that compiled it - #1760
Merged
Merged
Conversation
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
Benchmark (Ubuntu)
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. |
Benchmark (macOS)
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. |
Benchmark (Windows)
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
This was referenced Nov 30, 2026
…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
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>
This was referenced Dec 1, 2026
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.
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:
thing.custom, not matched byappendTsSuffixTothing.customthing.custom.tscomponent.vuematched byappendTsSuffixTo(script)component.vue?vue&type=script&lang=tscomponent.vue.tscomponent.vue(template)component.vue?vue&type=template&ts=truecomponent.vue.template.tsthing.custom.ts, took the file as never checked, and reported its errors a second time under that name. That copy was on no module, so it stayed after the file was fixed.appendTsSuffixTowere looked up undercomponent.vue.ts, which is no module's resource. webpack's persistent cache keeps a module's errors and not the compilation's, so both were lost when the modules were restored.The fix
pendingDiagnosticsis 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 andFileLayer.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
.vuefile'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;vueScriptLeavesProgramWatchreproduces it on Linux.FileLayer.resource,displayFileName), so the recheck finds the module without stored errors (getCompiledFile).vueRecheckedWhileNotImportedWatch). Before, they were shown without the module or its import trace.What changes for users
.vuetemplate'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 ofvueBlockRemovedWatchandvueBlocksDeletedWatchchange only in that way.Tests
noTsExtensionErrorsWatch(v10: a file without a TypeScript extension and without appendTsSuffixTo has its errors reported twice, and one copy stays after the error is fixed #1745): onnextthis reports two errors, and thething.custom.tsone remains after the fix inpatch2.vueBlocksPersistentCache(v10: a .vue template's type errors are not reported when its module is restored from webpack's persistent cache #1746): two.vuefiles, one matched byappendTsSuffixTo, each with an error in script and template, built by a new compiler per patch with the filesystem cache. Onnextone of the four errors survives the restore. It setsparallelism: 1so that the errors come in the same order every run.vueBlocksPersistentCachefirst expectedother.jsto be restored from the cache inpatch1. webpack doesn't trust the cache for a file changed that close to the build, so that came down to timing;patch1now changes the file again.Both comparison and execution test packs pass locally.
https://claude.ai/code/session_01Q2Jv7JZWr3VUxCkXiKB5e5
Generated by Claude Code