diff --git a/lib/v2.7/index.mjs b/lib/v2.7/index.mjs index 89a9c59..427038d 100644 --- a/lib/v2.7/index.mjs +++ b/lib/v2.7/index.mjs @@ -47,5 +47,28 @@ export function createApp(rootComponent, rootProps) { return app } -export { Vue, Vue2, isVue2, isVue3, install, warn } +export { + Vue, + Vue2, + isVue2, + isVue3, + install, + warn +} + +// Vue 3 components mock +function createMockComponent(name) { + return { + setup() { + throw new Error('[vue-demi] ' + name + ' is not supported in Vue 2. It\'s provided to avoid compiler errors.') + } + } +} +export var Fragment = /*#__PURE__*/ createMockComponent('Fragment') +export var Transition = /*#__PURE__*/ createMockComponent('Transition') +export var TransitionGroup = /*#__PURE__*/ createMockComponent('TransitionGroup') +export var Teleport = /*#__PURE__*/ createMockComponent('Teleport') +export var Suspense = /*#__PURE__*/ createMockComponent('Suspense') +export var KeepAlive = /*#__PURE__*/ createMockComponent('KeepAlive') + export * from 'vue' diff --git a/lib/v2/index.mjs b/lib/v2/index.mjs index 5af36b9..de9cab0 100644 --- a/lib/v2/index.mjs +++ b/lib/v2/index.mjs @@ -26,3 +26,19 @@ export { version, install, } + + +// Vue 3 components mock +function createMockComponent(name) { + return { + setup() { + throw new Error('[vue-demi] ' + name + ' is not supported in Vue 2. It\'s provided to avoid compiler errors.') + } + } +} +export var Fragment = /*#__PURE__*/ createMockComponent('Fragment') +export var Transition = /*#__PURE__*/ createMockComponent('Transition') +export var TransitionGroup = /*#__PURE__*/ createMockComponent('TransitionGroup') +export var Teleport = /*#__PURE__*/ createMockComponent('Teleport') +export var Suspense = /*#__PURE__*/ createMockComponent('Suspense') +export var KeepAlive = /*#__PURE__*/ createMockComponent('KeepAlive')