I’m currently developing a custom app within the Nextcloud environment and I’m looking ahead to the upcoming migration from Vue 2 to Vue 3.
As I understand it, Nextcloud is still on Vue 2 (specifically version 2.7.x), but there are plans to support Vue 3 in the near future. I’m trying to make sure my app is as future-proof as possible and I’m wondering what best practices I can follow now to make that transition easier when the time comes.
Given that Vue 2.7 supports the Composition API and TypeScript, would it be a good idea to start using them immediately in my app? Are there any limitations or pitfalls I should be aware of when using the Composition API and TypeScript in the current Nextcloud setup?
In short:
- Can I safely use the Composition API in a Nextcloud app today?
- Can I also use TypeScript without running into compatibility issues with Nextcloud’s current tooling?
- Any tips or things I should avoid to ease the migration to Vue 3 later?
Appreciate any guidance or shared experiences on this!
1 Like
I am not too much of a frontend dev but here are some point how I understand things:
- You are not requried to swtich to Composition API for Vue 3. You can safely stay with Options API.
- With the latest Vue 2 installed in your app, you can use Compositions API. This is a migration version that has some features (like Compositions API) backported for a more smooth experience. In the cookbook app (that I am maintainer of), we use the Composition API yet.
- Typescript is mainly your choice. NC helps you with various libraries that define NC-custom structures so that the TypeScript transpiler is happy. Again, the cookbook uses TypeScript right now.
- I cannot tell you if there are any libs or parts of the interface missing. In the worst case, you have to file a PR or polyfill that.
- Since Vue 3, Vue suggests to use Vite instead of Webpack for bundling. This has pros and cons. You decide again. You can migrate now or later, if you decided to use Vite.
Apart from that, the cookbook is still in Vue 2, so I am looking for pitfalls as well. So we might join forces
.
Chris
1 Like