Skip to content

Commit afbc5d5

Browse files
authored
fix(module): register _refreshHandler auto-import without .ts extension (#1094)
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.
1 parent 8f6df0c commit afbc5d5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/module.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,10 @@ export default defineNuxtModule<ModuleOptions>({
239239
}).dst
240240
addImports([{
241241
name: '_refreshHandler',
242-
from: generatedRefreshHandlerPath
242+
// Drop the `.ts` so every Nuxt command writes the same import path. Otherwise
243+
// `dev`/`prepare` keep it and `typecheck` drops it, which rewrites imports.d.ts
244+
// and invalidates the vue-tsc cache on each switch.
245+
from: generatedRefreshHandlerPath.replace(TS_ENDS_RE, '')
243246
}])
244247

245248
// 6. Register middleware for autocomplete in definePageMeta

0 commit comments

Comments
 (0)