Skip to content

Commit

Permalink
fix(language-core): use type infer instead of await import (vuejs#4436)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyuanzmj authored and coderfreii committed Jun 18, 2024
1 parent ae155c3 commit abac33e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export function* generateInternalComponent(
templateCodegenCtx: TemplateCodegenContext,
): Generator<Code> {
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) {
Expand Down Expand Up @@ -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}`;
Expand Down

0 comments on commit abac33e

Please sign in to comment.