Legacy angularjs (v1) cordova to capacitor ionic5 (not module based) how to migrate?

i know its a big jump (cordova and angular v1), but i am not wanting to rewrite the whole codebase, a codebase that is not on a build system and not leveraging Javascript modules. I do however want to use capacitor to gain access to more modern systems (and keep my cordova plugins for push, toast and others)

how are people using capacitor on apps that dont have build systems, or use javascript modules?

1 Like

It’s not ideal but you can certainly do it. Here’s an example: https://github.com/ionic-team/capacitor/tree/7e4b8f61909de40c991f4b789860d5b44defddd8/app-template/www

One thing missing from this: make sure to npm install @capacitor/core and then cp node_modules/@capacitor/core/dist/capacitorjs into the www folder here.

Once you do that, Capacitor objects will be made available at runtime natively, so that’s pretty much all you need to do!

would it be possible to mix ionic 1 with the new frameworks like ionic-vue? Let’s say you just want to build new “pages” on ionic-vue and leave ionic v1 pages “as is”, is it possible?

In theory, yes. I think a better bet would be to use vanilla Ionic web components in your Ionic 1 app. Then you’d continue to use AngularJS but would be able to use newer Ionic controls.

I did find this ngVue project that could be applied to Ionic Vue with Vue 3 perhaps, but it only supports Vue 2: https://github.com/ngVue/ngVue