phonegap / phonegap-template-react-hot-loader

PhoneGap Template using React, ES2015, Webpack, and hot module reloading
MIT License
79 stars 21 forks source link

How to deal with cordova.js while developing? #6

Closed Xzya closed 8 years ago

Xzya commented 8 years ago

cordova.js fails to load while running the app in development mode. The error I get is
Failed to load resource: the server responded with a status of 404 (Not Found) http://192.168.0.105:8080/cordova.js
obviously because the file is not on the server.
Is there any way to make it load cordova.js from the phone instead of the server?

devgeeks commented 8 years ago

Not really at the moment. The hot reloading server is great for working with UI aspects and logic that is not tied to Cordova functionality and plugins. Once your app is tied to those bits of functionality, it becomes a bit less useful.

We are working on ways that we might serve the correct Cordova.js for the platform, but it's not there yet.

darkyen commented 7 years ago

How about loading cordova.js from the device directly when developing instead of <script src="cordova.js"> load it directly from the device. Then on production it can be changed to the former value.

piotr-cz commented 6 years ago

I've had the same idea as @darkyen, however problem is that WebView denies access to cordova libary files: Not allowed to load local resource: file:///android_asset/www/cordova.js.

I was hoping the cordova-plugin-file and setting <preference name="AndroidExtraFilesystems" value="assets" /> will allow access but didn't

ATM I've decided to work around this by starting separate HTTP server to serve files from /platforms/android/platform_www/

sebqq commented 5 years ago

@piotr-cz did you make it work please?