From: Evan You Date: Mon, 23 Mar 2020 19:10:35 +0000 (-0400) Subject: fix: do not drop SFC runtime behavior code in global builds X-Git-Tag: v3.0.0-alpha.10~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4c1a193617bee8ace6fad289b78e9d2557cb081e;p=thirdparty%2Fvuejs%2Fcore.git fix: do not drop SFC runtime behavior code in global builds fix #873 --- diff --git a/packages/runtime-core/src/componentProxy.ts b/packages/runtime-core/src/componentProxy.ts index 442f3f32af..78ba4339cd 100644 --- a/packages/runtime-core/src/componentProxy.ts +++ b/packages/runtime-core/src/componentProxy.ts @@ -124,7 +124,6 @@ export const PublicInstanceProxyHandlers: ProxyHandler = { } return publicGetter(target) } else if ( - __BUNDLER__ && (cssModule = type.__cssModules) && (cssModule = cssModule[key]) ) { diff --git a/packages/runtime-core/src/helpers/scopeId.ts b/packages/runtime-core/src/helpers/scopeId.ts index b63f0e7b96..36aaf68ee8 100644 --- a/packages/runtime-core/src/helpers/scopeId.ts +++ b/packages/runtime-core/src/helpers/scopeId.ts @@ -8,28 +8,20 @@ export let currentScopeId: string | null = null const scopeIdStack: string[] = [] export function pushScopeId(id: string) { - if (__BUNDLER__) { - scopeIdStack.push((currentScopeId = id)) - } + scopeIdStack.push((currentScopeId = id)) } export function popScopeId() { - if (__BUNDLER__) { - scopeIdStack.pop() - currentScopeId = scopeIdStack[scopeIdStack.length - 1] || null - } + scopeIdStack.pop() + currentScopeId = scopeIdStack[scopeIdStack.length - 1] || null } export function withScopeId(id: string): (fn: T) => T { - if (__BUNDLER__) { - return ((fn: Function) => - withCtx(function(this: any) { - pushScopeId(id) - const res = fn.apply(this, arguments) - popScopeId() - return res - })) as any - } else { - return undefined as any - } + return ((fn: Function) => + withCtx(function(this: any) { + pushScopeId(id) + const res = fn.apply(this, arguments) + popScopeId() + return res + })) as any } diff --git a/packages/runtime-core/src/renderer.ts b/packages/runtime-core/src/renderer.ts index abf0065581..0385a6dcc3 100644 --- a/packages/runtime-core/src/renderer.ts +++ b/packages/runtime-core/src/renderer.ts @@ -563,16 +563,14 @@ function baseCreateRenderer( } // scopeId - if (__BUNDLER__) { - if (scopeId) { - hostSetScopeId(el, scopeId) - } - const treeOwnerId = parentComponent && parentComponent.type.__scopeId - // vnode's own scopeId and the current patched component's scopeId is - // different - this is a slot content node. - if (treeOwnerId && treeOwnerId !== scopeId) { - hostSetScopeId(el, treeOwnerId + '-s') - } + if (scopeId) { + hostSetScopeId(el, scopeId) + } + const treeOwnerId = parentComponent && parentComponent.type.__scopeId + // vnode's own scopeId and the current patched component's scopeId is + // different - this is a slot content node. + if (treeOwnerId && treeOwnerId !== scopeId) { + hostSetScopeId(el, treeOwnerId + '-s') } // children