Cordova插件错误:“未捕获的模块...已定义" [英] Cordova plugin error: "Uncaught module ... already defined"

查看:47
本文介绍了Cordova插件错误:“未捕获的模块...已定义"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下错误,我的自定义插件未启动.

I was getting the following error and my custom plugin wasn't starting.

未定义的模块com.example.example-plugin已定义"

为什么我的模块两次定义了?

Why is my module getting defined twice?

推荐答案

发生此错误是因为我将粘贴的代码从生成的"example-plugin.js"复制粘贴回原始插件文件中.

This error occurred because I copy-pasted code from the generated 'example-plugin.js' back into the original plugin file.

当我再次添加插件时,生成的代码然后被包装两次,如下所示:

When I added the plugin again, the generated code then got wrapped twice like this:

cordova.define("com.example.example-plugin",function(需要,导出,模块){cordova.define("com.example.example-plugin",function(需要,导出,模块)){var exec = require('cordova/exec');

从原始的example-plugin.js文件中删除生成的位,即可解决此问题.

Removing the generated bits from the original example-plugin.js file fixed this.

这篇关于Cordova插件错误:“未捕获的模块...已定义"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆