Skip to content

Commit

Permalink
fix: builtin components can't generate import statement with genSFCWi…
Browse files Browse the repository at this point in the history
…thDefaultPlugin method (opentiny#656)
  • Loading branch information
chilingling authored Jul 22, 2024
1 parent 2c27f91 commit 732bed9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/vue-generator/src/generator/vue/sfc/genSetupSFC.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { BUILTIN_COMPONENTS_MAP } from '@/constant'
import { getImportMap } from './parseImport'
import {
genTemplateByHook,
Expand Down Expand Up @@ -259,7 +260,10 @@ export const genSFCWithDefaultPlugin = (schema, componentsMap, config = {}) => {
}
}

return generateSFCFile(schema, componentsMap, newConfig)
// 兼容单独调用的场景,单独调用时,这里会默认加上 builtInComponents
const compsMapWithBuiltIn = [...componentsMap, ...BUILTIN_COMPONENTS_MAP]

return generateSFCFile(schema, compsMapWithBuiltIn, newConfig)
}

export default generateSFCFile

0 comments on commit 732bed9

Please sign in to comment.