Skip to content

Commit 4c1a193

Browse files
committed
fix: do not drop SFC runtime behavior code in global builds
fix #873
1 parent 4126a9d commit 4c1a193

File tree

3 files changed

+18
-29
lines changed

3 files changed

+18
-29
lines changed

packages/runtime-core/src/componentProxy.ts

-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
124124
}
125125
return publicGetter(target)
126126
} else if (
127-
__BUNDLER__ &&
128127
(cssModule = type.__cssModules) &&
129128
(cssModule = cssModule[key])
130129
) {

packages/runtime-core/src/helpers/scopeId.ts

+10-18
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,20 @@ export let currentScopeId: string | null = null
88
const scopeIdStack: string[] = []
99

1010
export function pushScopeId(id: string) {
11-
if (__BUNDLER__) {
12-
scopeIdStack.push((currentScopeId = id))
13-
}
11+
scopeIdStack.push((currentScopeId = id))
1412
}
1513

1614
export function popScopeId() {
17-
if (__BUNDLER__) {
18-
scopeIdStack.pop()
19-
currentScopeId = scopeIdStack[scopeIdStack.length - 1] || null
20-
}
15+
scopeIdStack.pop()
16+
currentScopeId = scopeIdStack[scopeIdStack.length - 1] || null
2117
}
2218

2319
export function withScopeId(id: string): <T extends Function>(fn: T) => T {
24-
if (__BUNDLER__) {
25-
return ((fn: Function) =>
26-
withCtx(function(this: any) {
27-
pushScopeId(id)
28-
const res = fn.apply(this, arguments)
29-
popScopeId()
30-
return res
31-
})) as any
32-
} else {
33-
return undefined as any
34-
}
20+
return ((fn: Function) =>
21+
withCtx(function(this: any) {
22+
pushScopeId(id)
23+
const res = fn.apply(this, arguments)
24+
popScopeId()
25+
return res
26+
})) as any
3527
}

packages/runtime-core/src/renderer.ts

+8-10
Original file line numberDiff line numberDiff line change
@@ -563,16 +563,14 @@ function baseCreateRenderer(
563563
}
564564

565565
// scopeId
566-
if (__BUNDLER__) {
567-
if (scopeId) {
568-
hostSetScopeId(el, scopeId)
569-
}
570-
const treeOwnerId = parentComponent && parentComponent.type.__scopeId
571-
// vnode's own scopeId and the current patched component's scopeId is
572-
// different - this is a slot content node.
573-
if (treeOwnerId && treeOwnerId !== scopeId) {
574-
hostSetScopeId(el, treeOwnerId + '-s')
575-
}
566+
if (scopeId) {
567+
hostSetScopeId(el, scopeId)
568+
}
569+
const treeOwnerId = parentComponent && parentComponent.type.__scopeId
570+
// vnode's own scopeId and the current patched component's scopeId is
571+
// different - this is a slot content node.
572+
if (treeOwnerId && treeOwnerId !== scopeId) {
573+
hostSetScopeId(el, treeOwnerId + '-s')
576574
}
577575

578576
// children

0 commit comments

Comments
 (0)