Q:

What does cordova compile exactly do?

The cordova documentation isn't clear about what the compile command does, specifically. All it says is: (Refer: cordova compile command)

cordova compile is a subset of the cordova build command. It only performs the compilation step without doing prepare. It's common to invoke cordova build instead of this command - however, this stage is useful to allow extending using hooks.

...and to see the build command docs for detailed documentation. And what the cordova build docs say is: (Refer: cordova build command)

Shortcut for cordova prepare + cordova compile for all/the specified platforms. Allows you to build the app for the specified platform.

But what does "build the app" means? I thought that the prepare command was responsible for copying, for instance, the wwwfolder to platforms output. But if so, what does compiledo then?

A:

prepare command is only responsible to copying files to specific platform. It does not do any other staff.
compile command simply compiles all the source code to platform-specific code. Suppose you have written some code for android platform so the java file name will be with .java extension. These source codes need to be compiled  to generate .class of that file.
Cordova also has own source codes specific to native platforms, so those codes also should be compiled.
As well as after compiling all of these source codes, it generates the output, (like for Android, APK will be generated).
I hope you understood.

