vue3-core/packages/vue/src/index.ts

25 lines
817 B
TypeScript
Raw Normal View History

2019-09-17 03:06:45 +08:00
// This package is the "full-build" that includes both the runtime
2019-09-20 12:24:16 +08:00
// and the compiler, and supports on-the-fly compilation of the template option.
import { compile, CompilerOptions } from '@vue/compiler-dom'
import { registerRuntimeCompiler, RenderFunction } from '@vue/runtime-dom'
2019-09-20 12:12:37 +08:00
function compileToFunction(
template: string,
options?: CompilerOptions
): RenderFunction {
const { code } = compile(template, options)
2019-09-23 04:50:57 +08:00
return new Function(code)() as RenderFunction
2019-09-20 12:12:37 +08:00
}
registerRuntimeCompiler(compileToFunction)
2019-09-20 12:24:16 +08:00
export { compileToFunction as compile }
2018-10-27 03:44:50 +08:00
export * from '@vue/runtime-dom'
2019-09-04 08:51:42 +08:00
if (__BROWSER__ && __DEV__) {
2019-09-04 08:51:42 +08:00
console[console.info ? 'info' : 'log'](
`You are running a development build of Vue.\n` +
`Make sure to use the production build (*.prod.js) when deploying for production.`
)
}