Skip to content

Commit b7a9c25

Browse files
CyberAPyyx990803
authored andcommitted
fix: expose Vue to compiled template (vuejs#120)
This removes the reliance on `Vue` being exposed as a global.
1 parent 5bc18f4 commit b7a9c25

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/vue/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// This package is the "full-build" that includes both the runtime
22
// and the compiler, and supports on-the-fly compilation of the template option.
33
import { compile, CompilerOptions } from '@vue/compiler-dom'
4+
import * as runtimeDom from '@vue/runtime-dom'
45
import { registerRuntimeCompiler, RenderFunction } from '@vue/runtime-dom'
56

67
function compileToFunction(
@@ -11,7 +12,7 @@ function compileToFunction(
1112
hoistStatic: true,
1213
...options
1314
})
14-
return new Function(code)() as RenderFunction
15+
return new Function('Vue', code)(runtimeDom) as RenderFunction
1516
}
1617

1718
registerRuntimeCompiler(compileToFunction)

0 commit comments

Comments
 (0)