ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

Do not mock cordova.js file if it exists

Open loicknuchel opened this issue 11 years ago • 3 comments

Hi,

I'm using the cordova.js file to mock plugins behaviours during browser development (https://github.com/loicknuchel/ionic-starter/blob/master/www/cordova.js). When I'm using ionic serve the local server do not serve my cordova.js file but serve an empty mock file (https://github.com/driftyco/ionic-cli/blob/dd1085b1bf66f6ee69c90d90355d12f9a34d01ff/lib/ionic/serve.js#L247).

It could be nice to serve this mock file (to prevent 404 error) only if it doesn't exists or, at least, to give a option to desactivate this feature.

Thanks !

loicknuchel avatar Mar 02 '15 00:03 loicknuchel

+1

phasnox avatar Apr 16 '15 15:04 phasnox

An other thing, insted of injecting an empty cordova.js file, you could inject a cordova.js file containing plugin mocks... If you do so, browser development will be a lot easier...

I can make some pull-requests for mocks of common plugins :)

loicknuchel avatar Apr 18 '15 19:04 loicknuchel

Unless I'm mistaken, I believe this issue also prevents Cordova plugins from being able to work under ionic run --livereload since ionic can't serve a valid cordova.js or cordova_plugins.js even if we copy it into the directory.

I'll see if I can get a --disable-cordova-mock flag working, since I'd like to be able to use plugins with ionic run --livereload if possible.

Update:

Never mind, ionic run --livereload does serve the correct cordova files if they exist.

Adding the flag ended up being pretty trivial though, so I did it anyways. =)

PR is here: https://github.com/driftyco/ionic-app-lib/pull/20

In the mean time you can give it a try with this fork of the ionic-cli: https://www.npmjs.com/package/ionic-no-cordova-mock

lewisl9029 avatar Aug 16 '15 00:08 lewisl9029