ionic serve doesn't support cordova browser plugins
Some (but not all) cordova plugins have Javascript proxies if the features they offer can also be used in a regular browser.
I'm using one such plugin and I need to access the cordova.plugins.____ object. However, the cordova.js file is a 404 when using ionic serve. It's not a 404 when using ionic build browser.
How do you access the cordova object in javascript when using ionic serve? Or do you have to ionic build browser every single time you want to see your changes?
+1
+1
+1
+1
+1
+1
+1
Facing the same issue with ionic serve. Hope this gets resolved soon. ionic run browser works for me though
- 1
+1
I'm experiencing this issue as well, and it really sucks that ionic run browser --livereload does not work either..
Is there anyone on the Ionic team that is looking into this?? I haven't seen anyone from them comment on this yet.
Throwing another +1 onto the heap
+1
This is really horrible... can you at least throw some log that that's the problem? Wasted a whole day on this...
If I do a ionic build browser, I noticed that the cordova.js and it's dependencies get built to /platforms/browser/cordova/platform_www. The question is (maybe), how do we get that output via WebPack to get generated to /www? Would LOVE to know the answer to that.
as mark-veenstra already wrote - but let me fix the port from 8100 -> 8000 which is the port the "ionic run browser" works:
add this to your gulp file under the other tasks:
gulp.task('browser:serve', function() {
gulp.src(paths.browser)
.pipe(webserver({
livereload: {enable: true, port: 35729},
directoryListing: false,
host: localhost,
port: 8000,
open: true
}));
});
ionic run browser --live-reload throws Error loading cordova-browser for me. Does anybody knows something about this
@LordPrettyFlacko I get that as well but am able to build and serve for browser (pulling in all js and hooks) with ionic build browser --desktop --testing && http-server platforms/browser/www/
@joshuaohana i tried this but my system cant find the http-server command. However it works for me now with ionic serve browser. I dont know why cause i tried so much thing but in the end it works.
What I have done as a hacky workaround for the time being is just do an ionic build browser and then I copy the platform_www folder from the platforms/browser directory into my www folder and then I reference it inside my index.html with <script src="platform_www/cordova.js"></script>. After doing that my ionic serve will then load all my cordova browser plugins.. (Works 90% of the time, i usually just refresh my page if the plugins don't load on initial startup.)
ionic build browser- copy
platforms/browser/platform_wwwfolder towwwfolder - add
<script src="platform_www/cordova.js"></script>toindex.html ionic serve(refresh page if plugins don't load at first.)
By using "ionic run browser --livereload" command I can see the trigger is active: "HTML changed: www\index.html"
however we need to run a command to compile our changes:
cordova prepare browser
I hope someone can fix it ASAP.