fix(compiler-ssr): avoid duplicated asset imports merged from component slot client branch

fix vitejs/vite#2034
This commit is contained in:
Evan You
2021-02-15 12:12:45 -05:00
parent a238da1082
commit c69f4ea857
4 changed files with 19 additions and 19 deletions

View File

@@ -289,14 +289,16 @@ function subTransform(
childContext.identifiers = { ...parentContext.identifiers }
// traverse
traverseNode(childRoot, childContext)
// merge helpers/components/directives/imports into parent context
;(['helpers', 'components', 'directives', 'imports'] as const).forEach(
key => {
childContext[key].forEach((value: any) => {
;(parentContext[key] as any).add(value)
})
}
)
// merge helpers/components/directives into parent context
;(['helpers', 'components', 'directives'] as const).forEach(key => {
childContext[key].forEach((value: any) => {
;(parentContext[key] as any).add(value)
})
})
// imports/hoists are not merged because:
// - imports are only used for asset urls and should be consistent between
// node/client branches
// - hoists are not enabled for the client branch here
}
function clone(v: any): any {