[Vue3] Ability to override built-in <Transition> component
Vue version
Vue >= 3.0
Link to minimal reproduction
https://github.com/nuxt/nuxt/issues/23712
Steps to reproduce
In Vue 2, we could do something like this:
Vue.component('transition', MockedTransitionComponent)
However, this doesn't work anymore because Vue is not a default export in version 3.x
What is expected?
Having the ability to mutate built-in components via existing API:
vueApp.component('transition', MockedComponent)
What is actually happening?
<Transition>
component is not being overridden.
System Info
No response
Any additional comments?
No response
I think this is not necessary. Transition is a built-in component and a reserved word of the compiler. You can change your own Transition to another name.
well, thanks for the quick response. Let me try it!! This requires updating all Transition in a huge mono-repo which is quite cumbersome
Unfortunately you cannot override built-in components in Vue 3 - this is intended as built-in components are resolved at compile time for treeshaking.
A global find-and-replace of all <transition>
usage to a custom global component sounds reasonable. You can then register different versions between prod and test where the prod version just re-exports the built-in.