What method are you using to debug your app? Cordova will only run if you are debugging with it. I’d suggest using Visual Studio Code with the Cordova tools extension to debug Cordova projects on the desktop.
Make sure your Javascript code falls inside of the ‘deviceready’ event. Cordova plugins will only become available once Cordova is properly initialised.
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Your plugin-specific code here
}
Cordova isn’t used when debugging on a standard web server or using Chrome/Safari/etc to view pages from the file system. You need to be running Cordova in the debug session, so make sure you either run on a physical device or in an IDE simulator, or run a Cordova simulator like the one for VS Code.
It would be great if you can point me to some github repository projects which are using webpack framework7 project.What is the syntax for accessing cordova plugin in app.js. Most probably it looks like it’s occuring due to incorrect syntax @nolimits4web Can you provide your valuable insight or a example?