fix(compiler-sfc): fix treeshaking of namespace import when used in template
fix #5209
This commit is contained in:
@@ -1011,10 +1011,13 @@ export function compileScript(
|
||||
for (let i = 0; i < node.specifiers.length; i++) {
|
||||
const specifier = node.specifiers[i]
|
||||
const local = specifier.local.name
|
||||
const imported =
|
||||
let imported =
|
||||
specifier.type === 'ImportSpecifier' &&
|
||||
specifier.imported.type === 'Identifier' &&
|
||||
specifier.imported.name
|
||||
if (specifier.type === 'ImportNamespaceSpecifier') {
|
||||
imported = '*'
|
||||
}
|
||||
const source = node.source.value
|
||||
const existing = userImports[local]
|
||||
if (
|
||||
@@ -1257,7 +1260,9 @@ export function compileScript(
|
||||
)) {
|
||||
if (isType) continue
|
||||
bindingMetadata[key] =
|
||||
(imported === 'default' && source.endsWith('.vue')) || source === 'vue'
|
||||
imported === '*' ||
|
||||
(imported === 'default' && source.endsWith('.vue')) ||
|
||||
source === 'vue'
|
||||
? BindingTypes.SETUP_CONST
|
||||
: BindingTypes.SETUP_MAYBE_REF
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user