wip: compat configuration

This commit is contained in:
Evan You
2021-04-07 11:22:56 -04:00
parent 068d93b9e5
commit e2fc84c773
8 changed files with 111 additions and 52 deletions

View File

@@ -7,7 +7,7 @@ import {
RenderFunction,
warn,
createApp,
createCompatVue
compatUtils
} from '@vue/runtime-dom'
import { isString, NOOP, generateCodeFrame, extend } from '@vue/shared'
import { InternalRenderFunction } from 'packages/runtime-core/src/component'
@@ -92,9 +92,10 @@ function compileToFunction(
registerRuntimeCompiler(compileToFunction)
const Vue = createCompatVue(createApp)
const Vue = compatUtils.createCompatVue(createApp)
Vue.compile = compileToFunction
extend(Vue, runtimeDom)
export default Vue

View File

@@ -1,15 +1,18 @@
// This entry exports the runtime only, and is built as
// `dist/vue.esm-bundler.js` which is used by default for bundlers.
import { initDev } from './dev'
import { warn } from '@vue/runtime-dom'
import { compatUtils, createApp, warn } from '@vue/runtime-dom'
import { extend } from '@vue/shared'
if (__DEV__) {
initDev()
}
export * from '@vue/runtime-dom'
import * as runtimeDom from '@vue/runtime-dom'
export const compile = () => {
const Vue = compatUtils.createCompatVue(createApp)
Vue.compile = (() => {
if (__DEV__) {
warn(
`Runtime compilation is not supported in this build of Vue.` +
@@ -22,4 +25,8 @@ export const compile = () => {
: ``) /* should not happen */
)
}
}
}) as any
extend(Vue, runtimeDom)
export default Vue