cordova.js causes reference error 'require is not defined'

雨燕双飞 提交于 2019-12-05 22:15:29

The answer here is that the Cordova CLI automatically includes cordova.js and any necessary dependancies when you build the application.

The cordova.js file is placed in the www directory, so all you have to do is include that file -

<script type="text/javascript" src="cordova.js"></script>

It seems illogical to reference a file that you are not inculding, but once you get your head around how the CLI works it makes sense.

The main problem for beginners is that it's quite poorly documented. In fact, Cordova as a whole seems to be poorly documented, not so much in terms of quantity but rather the relevance - so much is for old versions. It's a fantastic project though, and hopefully this is something that will be addressed in the near future.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!