diff --git a/packages/language-core/lib/codegen/script/internalComponent.ts b/packages/language-core/lib/codegen/script/internalComponent.ts index 86f99b98fb..207cd8daa9 100644 --- a/packages/language-core/lib/codegen/script/internalComponent.ts +++ b/packages/language-core/lib/codegen/script/internalComponent.ts @@ -12,7 +12,8 @@ export function* generateInternalComponent( templateCodegenCtx: TemplateCodegenContext ): Generator { if (options.sfc.scriptSetup && options.scriptSetupRanges) { - yield `const __VLS_internalComponent = (await import('${options.vueCompilerOptions.lib}')).defineComponent({${newLine}`; + yield `let __VLS_defineComponent!: typeof import('${options.vueCompilerOptions.lib}').defineComponent${endOfLine}`; + yield `const __VLS_internalComponent = __VLS_defineComponent({${newLine}`; yield `setup() {${newLine}`; yield `return {${newLine}`; if (ctx.bypassDefineComponent) { @@ -56,7 +57,7 @@ export function* generateInternalComponent( yield `})${endOfLine}`; // defineComponent { } else if (options.sfc.script) { - yield `const __VLS_internalComponent = (await import('./${options.fileBaseName}')).default${endOfLine}`; + yield `let __VLS_internalComponent!: typeof import('./${options.fileBaseName}').default${endOfLine}`; } else { yield `const __VLS_internalComponent = (await import('${options.vueCompilerOptions.lib}')).defineComponent({})${endOfLine}`;