]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: expose Vue to compiled template (#120)
authorStanislav Lashmanov <stasvarenkin@gmail.com>
Sun, 6 Oct 2019 15:38:05 +0000 (18:38 +0300)
committerEvan You <yyx990803@gmail.com>
Sun, 6 Oct 2019 15:38:05 +0000 (11:38 -0400)
This removes the reliance on `Vue` being exposed as a global.

packages/vue/src/index.ts

index d4604ad91df0b15670c59a108636b9a691ac146b..3ad4bca05cb6bbca906947af6f1d49b25ed6aac0 100644 (file)
@@ -1,6 +1,7 @@
 // This package is the "full-build" that includes both the runtime
 // and the compiler, and supports on-the-fly compilation of the template option.
 import { compile, CompilerOptions } from '@vue/compiler-dom'
+import * as runtimeDom from '@vue/runtime-dom'
 import { registerRuntimeCompiler, RenderFunction } from '@vue/runtime-dom'
 
 function compileToFunction(
@@ -11,7 +12,7 @@ function compileToFunction(
     hoistStatic: true,
     ...options
   })
-  return new Function(code)() as RenderFunction
+  return new Function('Vue', code)(runtimeDom) as RenderFunction
 }
 
 registerRuntimeCompiler(compileToFunction)