fix(module): register _refreshHandler auto-import without .ts extension#1094
Merged
phoenix-ru merged 1 commit intoJun 30, 2026
Merged
Conversation
The auto-import path carried a .ts extension, so Nuxt's codegen wrote a different specifier for dev/prepare vs typecheck. That flip rewrote imports.d.ts and invalidated the vue-tsc incremental cache on every command switch. Strip the extension so every command emits the same path.
commit: |
phoenix-ru
approved these changes
Jun 30, 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.
🔗 Linked issue
Closes #1093
❓ Type of change
📚 Description
The module registered the
_refreshHandlerauto-import using the generated template's.dst, which still carries a.tsextension. Nuxt's auto-import codegen normalizes that specifier inconsistently across commands:nuxt dev/nuxt preparekeep the.ts, whilenuxt typecheckdrops it. Becauseimports.d.tsis a global declaration, that flip rewrites it on every command switch and invalidates thevue-tscincremental cache, so the next type check runs cold.This strips the extension with
TS_ENDS_RE, the same treatment the module already applies to the custom-handler path a few lines up. With it gone,nuxt dev,nuxt prepare, andnuxt typecheckall emit the identicalimport('../refreshHandler')line, so the global declaration stops changing and the cache survives. Resolution is unaffected:nuxt typecheckwas already emitting and type-checking that exact extensionless form.On a large Nuxt 4 app, a controlled before/after benchmark showed the dev-to-typecheck path drop from about 150s (cold) to about 21s (warm), roughly 7x. Full details and the benchmark log are in #1093.
📝 Checklist