Skip to content

fix(module): register _refreshHandler auto-import without .ts extension#1094

Merged
phoenix-ru merged 1 commit into
sidebase:mainfrom
kboshold:fix/refresh-handler-import-extension
Jun 30, 2026
Merged

fix(module): register _refreshHandler auto-import without .ts extension#1094
phoenix-ru merged 1 commit into
sidebase:mainfrom
kboshold:fix/refresh-handler-import-extension

Conversation

@kboshold

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Closes #1093

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

The module registered the _refreshHandler auto-import using the generated template's .dst, which still carries a .ts extension. Nuxt's auto-import codegen normalizes that specifier inconsistently across commands: nuxt dev/nuxt prepare keep the .ts, while nuxt typecheck drops it. Because imports.d.ts is a global declaration, that flip rewrites it on every command switch and invalidates the vue-tsc incremental 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, and nuxt typecheck all emit the identical import('../refreshHandler') line, so the global declaration stops changing and the cache survives. Resolution is unaffected: nuxt typecheck was 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

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.

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.
@pkg-pr-new

pkg-pr-new Bot commented Jun 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@sidebase/nuxt-auth@1094

commit: ed4aca9

@phoenix-ru phoenix-ru merged commit afbc5d5 into sidebase:main Jun 30, 2026
6 checks passed
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.

refreshHandler auto-import keeps a .ts extension and busts the vue-tsc incremental cache

2 participants