let compile: CompileFunction | undefined
+// dev only
+export const isRuntimeOnly = () => !compile
+
/**
* For runtime-dom to register the compiler.
* Note the exported method uses any to avoid d.ts relying on the compiler types.
resolveDynamicComponent
} from './helpers/resolveAssets'
// For integration with runtime compiler
-export { registerRuntimeCompiler } from './component'
+export { registerRuntimeCompiler, isRuntimeOnly } from './component'
export {
useTransitionState,
resolveTransitionHooks,
Renderer,
HydrationRenderer,
App,
- RootHydrateFunction
+ RootHydrateFunction,
+ isRuntimeOnly
} from '@vue/runtime-core'
import { nodeOps } from './nodeOps'
import { patchProp, forcePatchProp } from './patchProp'
if (__DEV__) {
injectNativeTagCheck(app)
+ injectCustomElementCheck(app)
}
const { mount } = app
if (__DEV__) {
injectNativeTagCheck(app)
+ injectCustomElementCheck(app)
}
const { mount } = app
})
}
+// dev only
+function injectCustomElementCheck(app: App) {
+ if (isRuntimeOnly()) {
+ const value = app.config.isCustomElement
+ Object.defineProperty(app.config, 'isCustomElement', {
+ get() {
+ return value
+ },
+ set() {
+ warn(
+ `The \`isCustomElement\` config option is only respected when using the runtime compiler.` +
+ `If you are using the runtime-only build, \`isCustomElement\` must be passed to \`@vue/compiler-dom\` in the build setup instead` +
+ `- for example, via the \`compilerOptions\` option in vue-loader: https://vue-loader.vuejs.org/options.html#compileroptions.`
+ )
+ }
+ })
+ }
+}
+
function normalizeContainer(
container: Element | ShadowRoot | string
): Element | null {