]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: do not drop SFC runtime behavior code in global builds
authorEvan You <yyx990803@gmail.com>
Mon, 23 Mar 2020 19:10:35 +0000 (15:10 -0400)
committerEvan You <yyx990803@gmail.com>
Mon, 23 Mar 2020 19:10:35 +0000 (15:10 -0400)
fix #873

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

index 442f3f32af0cbad78f42a0493b53035e5286f2e6..78ba4339cd2410f891f9b1d8849698e8432df048 100644 (file)
@@ -124,7 +124,6 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
       }
       return publicGetter(target)
     } else if (
-      __BUNDLER__ &&
       (cssModule = type.__cssModules) &&
       (cssModule = cssModule[key])
     ) {
index b63f0e7b96c2ad3e0e51550a4bf67a47c8621248..36aaf68ee8219bfa805593da4f880806a3a9dcc6 100644 (file)
@@ -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): <T extends Function>(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
 }
index abf0065581cf49a1c6019b11fbaadc3ff12111e7..0385a6dcc38f202b19b74ebd323933c0e70bccd0 100644 (file)
@@ -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