Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npx cap sync vs npx cap copy

I am new to the capacitor and developing an application where I am making changes into code and running

  1. ionic build
  2. npx cap copy
  3. npx cap open android

And it is also recommended to use npx cap sync in behalf of npx cap copy. What is the exactly difference between both. where to use which one ? Please assist.

like image 432
Neha Shah Avatar asked Apr 20 '20 13:04

Neha Shah


People also ask

What is NPX cap sync?

npx cap update searches for Cordova and Capacitor plugins and copy/update some native files the plugins need for working. So copy is for "web" files and update for "native" files and sync does both. Answered By - jcesarmobile.

What does ionic cap Sync do?

ionic capacitor sync will do the following: Perform an Ionic build, which compiles web assets. Copy web assets to Capacitor native platform(s) Update Capacitor native platform(s) and dependencies.


1 Answers

npx cap copy just copies whatever is in your webDir to the native platforms (and some cordova files if you have cordova plugins installed).

npx cap sync runs npx cap copy and npx cap update

npx cap update searches for Cordova and Capacitor plugins and copy/update some native files the plugins need for working.

So copy is for "web" files and update for "native" files and sync does both.

like image 128
jcesarmobile Avatar answered Oct 26 '22 17:10

jcesarmobile