File tree 3 files changed +27
-2
lines changed
3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -653,6 +653,9 @@ type CompileFunction = (
653
653
654
654
let compile : CompileFunction | undefined
655
655
656
+ // dev only
657
+ export const isRuntimeOnly = ( ) => ! compile
658
+
656
659
/**
657
660
* For runtime-dom to register the compiler.
658
661
* 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 {
87
87
resolveDynamicComponent
88
88
} from './helpers/resolveAssets'
89
89
// For integration with runtime compiler
90
- export { registerRuntimeCompiler } from './component'
90
+ export { registerRuntimeCompiler , isRuntimeOnly } from './component'
91
91
export {
92
92
useTransitionState ,
93
93
resolveTransitionHooks ,
Original file line number Diff line number Diff line change 7
7
Renderer ,
8
8
HydrationRenderer ,
9
9
App ,
10
- RootHydrateFunction
10
+ RootHydrateFunction ,
11
+ isRuntimeOnly
11
12
} from '@vue/runtime-core'
12
13
import { nodeOps } from './nodeOps'
13
14
import { patchProp , forcePatchProp } from './patchProp'
@@ -55,6 +56,7 @@ export const createApp = ((...args) => {
55
56
56
57
if ( __DEV__ ) {
57
58
injectNativeTagCheck ( app )
59
+ injectCustomElementCheck ( app )
58
60
}
59
61
60
62
const { mount } = app
@@ -83,6 +85,7 @@ export const createSSRApp = ((...args) => {
83
85
84
86
if ( __DEV__ ) {
85
87
injectNativeTagCheck ( app )
88
+ injectCustomElementCheck ( app )
86
89
}
87
90
88
91
const { mount } = app
@@ -105,6 +108,25 @@ function injectNativeTagCheck(app: App) {
105
108
} )
106
109
}
107
110
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
+
108
130
function normalizeContainer (
109
131
container : Element | ShadowRoot | string
110
132
) : Element | null {
You can’t perform that action at this time.
0 commit comments