Search code examples
angularjscapacitor

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.


Solution

  • 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.