apache / cordova-plugin-file-transfer

Apache Cordova File Transfer Plugin
https://cordova.apache.org/
Apache License 2.0
595 stars 888 forks source link

Can't resolve 'cordova-plugin-file-transfer' #358

Closed marcelloinfoweb closed 1 year ago

marcelloinfoweb commented 1 year ago

Install command: npm install https://github.com/apache/cordova-plugin-file-transfer

Command: vue-cli-service serve image

breautek commented 1 year ago

Cordova plugins aren't really an NPM module so to speak. They are distributed through NPM, but they cannot be required or resolved as a typical NPM module. Cordova has it's own module system in which Cordova will embed the plugin's JS into your application when Cordova is loaded, clobbering the global namespace as defined in their plugin.xml file. It is an antiquated system, an artefact that existed before NPM even existed.

So to work around your issue, remove the cordova-plugin-file-transfer import in your code. Depending on your framework/build system, you may also need to prefix the API call with window. or configure it to accept additional global variables.

As long as the deviceready event has fired, any cordova plugin APIs should be available and ready to be used.

Closing as not a bug.