Adriano Di Giovanni
Adriano Di Giovanni

Reputation: 1515

How to update cordova.js?

I need to update cordova.js in order to have issue CB-7868 fixed on a Cordova project of mine.

I ran all commands stated in this post but I can't get cordova.js updated.

My Cordova project is for the Android platform.

Upvotes: 0

Views: 1496

Answers (2)

Adriano Di Giovanni
Adriano Di Giovanni

Reputation: 1515

I ended up doing as follows

  • copy platforms/android/assets/www/cordova.js to www/cordova.patched.js;
  • edit www/cordova.patched.js to replace clobber function with the updated one from [email protected];
  • edit www/index.html to link cordova.patched.js instead of cordova.js;
  • run cordova prepare android.

I also put a console.warn to remember I'm using a patched version of cordova.js.

Upvotes: 0

codevision
codevision

Reputation: 5520

You have to manually update NPM package with fix, or wait for next tools release (later then Nov 13)

  • If you will wait for next release then you should run cordova platform update android

  • If you want to one-time patch then you have to replace content of platforms/android/assets/www/cordova.js with your patched version, or modify that file according to your needs.

  • If you want to permanently have manually patch then you have to do following steps.

    a) Open cordova NPM package where it is stored by NPM.

    On Windows: %appdata%\npm-cache\cordova-js

    On Linux ~/.npm/cordova-js

    b) Inside that you will see specific version of Cordova, 3.7.1 for example.

    c) Inside that folder package.tgz, unpack it content to another folder, let's use ~/cordova-js-modified for reference.

    d) Modify file package/cordova.js according to your needs and save.

    e) Repack content of ~/cordova-js-modified to package.tgz and place it again in the 3.7.1 folder.

    f) Now you will have modified version which will be applied each time you run cordova commands.

Upvotes: 1

Related Questions