DEV Community

Be prepared to migrate your Vue app to Vue 3

Albert Mulia Shintra on July 12, 2020

Heya! In this post, I would like to share my recent experience of trying out Vue 3 beta version, specifically regarding some caveats you might wan...
Collapse
 
artofintel profile image
ArtOfIntel

Simple and useful, thx.
Where's the link to this "if you love Typescript,.... I'll write a separated article about it ;)" ?

Collapse
 
chenxeed profile image
Albert Mulia Shintra

Thanks for checking!

I'll post a new article in a few days, will share it here once I do!

Collapse
 
sonicoder profile image
Gábor Soós

Here is some Typescript love until the article :)

Just code examples, but it's more than nothing

Collapse
 
artofintel profile image
ArtOfIntel

Thanks

Collapse
 
chenxeed profile image
Albert Mulia Shintra

Fresh from the oven, thanks for asking!

dev.to/chenxeed/consider-vue-compo...

Collapse
 
nonary profile image
Nonary • Edited

Using composition API will break Vetur if you’re using the template interpolation feature (where it type checks the html and verifies bound properties exists)

In addition the Vue dev tools will crash significantly more often as it does not officially support the plugin.

So if you rely on that I’d recommend not installing the plugin.

Collapse
 
dotaitch profile image
Heena Kwag

Thank you for the great article! It was very useful for me 👍

I would like to ask you for permission to translate this article into Korean and publish it on a company run blog (ui.toast.com/). I will quote the source and in no way use it to gain any monetary value.

Please let me know what you think, and hope you have a great day :)

Collapse
 
chenxeed profile image
Albert Mulia Shintra

Hi, feel free to use this article! It's my honour 👍

Collapse
 
wormss profile image
WORMSS

And if you are using vue-property-decorator?

Collapse
 
chenxeed profile image
Albert Mulia Shintra • Edited

Ah, good concern! I missed to mention it in the article above, that the Vue Class Component is also in the discussion to be available in Vue 3. I think the issue below mentioned some breaking changes to be noted:

github.com/vuejs/vue-class-compone...

Collapse
 
wormss profile image
WORMSS

Wow, the example given looks really weird with watchers being external. We use vue-property-decorator which would do things like

import { Component, Ref, Watcher, Vue } from 'vue-property-decorator';
import NestedComponent from './NestedComponent';
@Component({ components: { NestedComponent }})
export default class MyClass extends Vue {
  @Ref()
  private someRef?: HTMLInputElement;
  private someData: string;
  private someComputed(): string { return window.localStorage.getItem('foobar') ?? '' }
  @Watcher('someData', { immediate: true })
  private onSomeDataChanged(newValue: string, oldValue?: string) {
    if(this.someRef) { this.someRef.focus(); }
  }
}

Just hope there are no super significant changes. We have over 925 *.vue files, all of them using vue-property-decorator

Thread Thread
 
chenxeed profile image
Albert Mulia Shintra

Yeah it'll be a hassle to migrate each of your vue files. Hopefully they don't deprecate the common interfaces in the new version for Vue 3.

Collapse
 
sonicoder profile image
Gábor Soós

Great writeup!

It's important that the v-model props and events are also changing along with the removal of the global Vue instance.

Collapse
 
sovai profile image
Sovai Kean

Very useful, thanks for the post!

Collapse
 
danielkun profile image
Daniel Albuschat

Thanks! I'll come back to this article when Vue 3 is out and it's time for us to upgrade. But it's good to know what to avoid in the meantime. 💯

Collapse
 
chenxeed profile image
Albert Mulia Shintra

Thank you for your feedback!

Collapse
 
klukiyan profile image
Kiril Lukiyan

I'll rather not do anything until Vue3 finally officially comes out. It seems to take forever.

Collapse
 
sonicoder profile image
Gábor Soós

It's just around the corner

Collapse
 
mzaini30 profile image
Zen

Thanks! I'll rewatch my code.

Collapse
 
chenxeed profile image
Albert Mulia Shintra

You're welcome! Hope it helps!