Skip to content

Commit

Permalink
fix: don't import alias macros (#3576)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Sep 21, 2023
1 parent 4d25501 commit f6cf25c
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/vue-language-core/src/generators/script.ts
Expand Up @@ -466,15 +466,9 @@ export function generate(
if (vueCompilerOptions.target >= 3.3) {
const bindings = new Set(scriptSetupRanges.bindings.map(range => sfc.scriptSetup!.content.substring(range.start, range.end)));
codes.push('const { ');
for (const [macro, aliases] of Object.entries(vueCompilerOptions.macros)) {
for (const alias of aliases) {
if (!bindings.has(alias)) {
codes.push(macro);
if (alias !== macro) {
codes.push(` : ${alias}`);
}
codes.push(`, `);
}
for (const macro of Object.keys(vueCompilerOptions.macros)) {
if (!bindings.has(macro)) {
codes.push(macro, ', ');
}
}
codes.push(`} = await import('${vueCompilerOptions.lib}');\n`);
Expand Down

0 comments on commit f6cf25c

Please sign in to comment.