Complex migration from Ionic4/Cordova to Ionic5/Capacitor

Hi,
I have a big and complex app that uses many Cordova plugins.
The app is in Ionic 4 and the version of Cordova is 9.

I’d like to migrate gradually from Ionic4/Cordova to Ionic5/Capacitor.
I know that some Cordova plugins don’t have a correspondent plugin in Capacitor, so probably at the beginning, I have to use both.

So, according to you, is this migration possible?
What are the first steps that I should face?

Thank you

Claudio

Generally, yes, but…

I would start by writing a dummy Capacitor app that incorporates every Cordova plugin you’re going to need, to ensure that they’re all compatible. Some Cordova plugins simply don’t work with Capacitor at the moment.

2 Likes

Instead of using a dummy app, just add capacitor to your existing app, it creates new folders for the capacitor native projects, won’t break your existing Cordova projects, so it’s safe to add.
If using git it’s recommended to use a new branch so it’s easier to remove if it doesn’t work, but if not you just have to remove ios and android folders and uninstall @capacitor npm packages.
If some plugin doesn’t work you can report it on github

2 Likes

Thank you @rapropos, so perhaps the first thing should be update all the plugins and the libraries of the app.
Then apply the Ionic 5 migration.

If Cordova and Capacitor are not compatible, this should be a problem

Thank you @jcesarmobile if Capacitor and Cordova are compatible then I can do as you say.
Of course, I will use a new branch to test that all works as expected.
I will try this way.

cld

Hi @ioclaudio,
How did this go for you? Thinking of doing the same; also for a complex app.

We didn’t upgrade that App to Ionic5.
I’ve just installed the new version of all the plugins.
I’ve seen that often Ionic5 still uses Cordova, so I don’t think that at the moment is so important to upgrade the old app to Ionic5.

cld