# ionic2 serve + cordova plugins

**URL:** <https://forum.ionicframework.com/t/ionic2-serve-cordova-plugins/44320>\
**Category:** ionic-v3\
**Created:** [February 21, 2016, 10:23am UTC](https://forum.ionicframework.com/t/ionic2-serve-cordova-plugins/44320 "2016-02-21T10:23:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebastianovide](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sebastianovide/32/97090_2.png) [@sebastianovide](https://forum.ionicframework.com/u/sebastianovide)\
**Post date:** [February 21, 2016, 10:23am UTC](https://forum.ionicframework.com/t/ionic2-serve-cordova-plugins/44320/1 "2016-02-21T10:23:16Z")

</div>

Hi All,

I’ve used phonegap a couple of years ago and I’ve felt the pain of testing the apps in the browser.  
I’ve recently discovered Ionic and now I’m giving it a try, specifically Ionic V2, with the hope that it will be easier.

I’m trying to use the cordova-plugin-file which according to its documentation works also on browsers. How can I use “ **ionic serve** ” while using these kind of plugins that supposedly should work in the browsers ?

Thanks

**edit:**

**ionic run browser** works… but it doesn’t have the live-reload which is so handy… That’s means that I need to restart it everytime I make a change (+10 seconds). Am I missing anything ?

---

<div class="post-metadata">

**Author:** ![joshmorony](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/joshmorony/32/117695_2.png) [@joshmorony](https://forum.ionicframework.com/u/joshmorony)\
**Post date:** [February 21, 2016, 1:23pm UTC](https://forum.ionicframework.com/t/ionic2-serve-cordova-plugins/44320/2 "2016-02-21T13:23:12Z")

</div>

What issue are you running into? What code are you trying to run and what is happening? Any errors occurring in the console?

As you mentioned, Cordova plugins won’t work through the browser, but if they implement a HTML5 API then in some cases they will (not that the Cordova plugin is running through the browser, there is just also a HTML5 API available that uses the same syntax, so you don’t run into errors). So, if a HTML5 API is available it should work fine when running using `ionic serve`

If you can provide some more details we might be able to help more easily.

---

<div class="post-metadata">

**Author:** ![sebastianovide](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sebastianovide/32/97090_2.png) [@sebastianovide](https://forum.ionicframework.com/u/sebastianovide)\
**Post date:** [February 21, 2016, 8:08pm UTC](https://forum.ionicframework.com/t/ionic2-serve-cordova-plugins/44320/3 "2016-02-21T20:08:27Z")

</div>

just an empty new app with a cordova plugin: I’ve added the cordova-plugin-file plugin and a 2 “debugger” inside `initializeApp`

```
  initializeApp() {
    debugger; // 1
    // console.log(cordova.file);
    this.platform.ready().then(() => {
      window.addEventListener('filePluginIsReady', () => {
        console.log('File plugin is ready');
        debugger; // 2
        console.log(cordova.file);
      }, false);

```

1. doing **`ionic serve`** in the `debugger 1` , `cordova` is not defined as the plugin is not loaded and therefore it will never stop in the `debugger 2`.

- doing **`ionic run browser`** the plugin is loaded and therefore you can see `cordova.file` defined in the `debugger 1`. You can also see the app stoping in `debugger 2` as expected. The only problem is that after applying changes to a .ts (or .js) file, I need to stop it and run it again (10 to 15 seconds).

So the **second method (`ionic run browser`)** would be perfect if it would be clever as the method 1 (`ionic serve`) and build only what needed in real time.

**edit** : I’vw wrote a quick workaorund in [https://github.com/driftyco/ionic-cli/issues/790:](https://github.com/driftyco/ionic-cli/issues/790:) After changing a file, wait until when the console shows the file changed and then:  
`rsync -rtv www/ platforms/browser/www`

---

<div class="post-metadata">

**Author:** ![narasimham3](https://avatars.discourse-cdn.com/v4/letter/n/d6d6ee/32.png) [@narasimham3](https://forum.ionicframework.com/u/narasimham3)\
**Post date:** [February 22, 2016, 10:18am UTC](https://forum.ionicframework.com/t/ionic2-serve-cordova-plugins/44320/5 "2016-02-22T10:18:15Z")

</div>

We are creating the Mobile Applications so when you add the any cordova plug in check in mobile not in broewser

Thank you
