feat: on-the-fly template compilation
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
// This package is the "full-build" that includes both the runtime
|
||||
// and the compiler. For now we are just exporting everything from the runtome
|
||||
// AND the compiler.
|
||||
|
||||
// TODO hook up the runtime to compile templates on the fly
|
||||
|
||||
// and the compiler, and supports on-the-fly compilation of the template option.
|
||||
import { compile as baseCompile, CompilerOptions } from '@vue/compiler-dom'
|
||||
import { registerCompiler } from '@vue/runtime-dom'
|
||||
|
||||
export function compile(template: string, options?: CompilerOptions): Function {
|
||||
const { code } = baseCompile(template, options)
|
||||
return new Function(`with(this){return ${code}}`)
|
||||
}
|
||||
|
||||
registerCompiler(compile)
|
||||
|
||||
export * from '@vue/runtime-dom'
|
||||
|
||||
if (__BROWSER__ && __DEV__) {
|
||||
|
||||
Reference in New Issue
Block a user