File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -653,6 +653,9 @@ type CompileFunction = (
653653
654654let compile : CompileFunction | undefined
655655
656+ // dev only
657+ export const isRuntimeOnly = ( ) => ! compile
658+
656659/**
657660 * For runtime-dom to register the compiler.
658661 * Note the exported method uses any to avoid d.ts relying on the compiler types.
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export {
8787 resolveDynamicComponent
8888} from './helpers/resolveAssets'
8989// For integration with runtime compiler
90- export { registerRuntimeCompiler } from './component'
90+ export { registerRuntimeCompiler , isRuntimeOnly } from './component'
9191export {
9292 useTransitionState ,
9393 resolveTransitionHooks ,
Original file line number Diff line number Diff line change 77 Renderer ,
88 HydrationRenderer ,
99 App ,
10- RootHydrateFunction
10+ RootHydrateFunction ,
11+ isRuntimeOnly
1112} from '@vue/runtime-core'
1213import { nodeOps } from './nodeOps'
1314import { patchProp , forcePatchProp } from './patchProp'
@@ -55,6 +56,7 @@ export const createApp = ((...args) => {
5556
5657 if ( __DEV__ ) {
5758 injectNativeTagCheck ( app )
59+ injectCustomElementCheck ( app )
5860 }
5961
6062 const { mount } = app
@@ -83,6 +85,7 @@ export const createSSRApp = ((...args) => {
8385
8486 if ( __DEV__ ) {
8587 injectNativeTagCheck ( app )
88+ injectCustomElementCheck ( app )
8689 }
8790
8891 const { mount } = app
@@ -105,6 +108,25 @@ function injectNativeTagCheck(app: App) {
105108 } )
106109}
107110
111+ // dev only
112+ function injectCustomElementCheck ( app : App ) {
113+ if ( isRuntimeOnly ( ) ) {
114+ const value = app . config . isCustomElement
115+ Object . defineProperty ( app . config , 'isCustomElement' , {
116+ get ( ) {
117+ return value
118+ } ,
119+ set ( ) {
120+ warn (
121+ `The \`isCustomElement\` config option is only respected when using the runtime compiler.` +
122+ `If you are using the runtime-only build, \`isCustomElement\` must be passed to \`@vue/compiler-dom\` in the build setup instead` +
123+ `- for example, via the \`compilerOptions\` option in vue-loader: https://vue-loader.vuejs.org/options.html#compileroptions.`
124+ )
125+ }
126+ } )
127+ }
128+ }
129+
108130function normalizeContainer (
109131 container : Element | ShadowRoot | string
110132) : Element | null {
You can’t perform that action at this time.
0 commit comments