Open dbenge opened 8 years ago
Hi dbenge! I am having exactly same issue on my end. Did you find an alternative?
Not yet but I will be looking into it this week.
Hi dbenge,
I came back to this issue and did some deeper investigation. The problem I detected is actualy on the plugin.xml file.
Basically, on lines 90 and 97 you have something like this:
90: <js-module src="src/windows8/platform.js" name="platform">
97: <js-module src="src/windows8/platform.js" name="platform">
The problem is that, as you can see, the name "platform" is being used. And later, during the cordova_plugins.js generation, it turns out that this name is already taken by the main platform agnostic javascript:
Platform agnostic one(plugins/cordova-plugin-app-preferences/src/platform.js):
{
"file": "plugins/cordova-plugin-app-preferences/src/platform.js",
"id": "cordova-plugin-app-preferences.platform",
"pluginId": "cordova-plugin-app-preferences"
},
Platform specific one(plugins/cordova-plugin-app-preferences/src/windows8/platform.js):
{
"file": "plugins/cordova-plugin-app-preferences/src/windows8/platform.js",
"id": "cordova-plugin-app-preferences.platform",
"pluginId": "cordova-plugin-app-preferences",
"merges": [
""
]
},
That triggered the error!
With that in mind, I got it fixed, at least temporarily, by changing my plugin.xml to something like this:
90: <js-module src="src/windows8/platform.js" name="platform.w8">
97: <js-module src="src/windows8/platform.js" name="platform.windows">
Once I have done that, the cordova_plugins.js was generated without the duplication!!!
Platform agnostic one(plugins/cordova-plugin-app-preferences/src/platform.js):
{
"file": "plugins/cordova-plugin-app-preferences/src/platform.js",
"id": "cordova-plugin-app-preferences.platform",
"pluginId": "cordova-plugin-app-preferences"
},
Platform specific one(plugins/cordova-plugin-app-preferences/src/windows8/platform.js):
{
"file": "plugins/cordova-plugin-app-preferences/src/windows8/platform.js",
"id": "cordova-plugin-app-preferences.platform.windows",
"pluginId": "cordova-plugin-app-preferences",
"merges": [
""
]
},
I hope that this fix on your end as well. I actually just made a pull request with this fix... https://github.com/apla/me.apla.cordova.app-preferences/pull/83
BR Pedro
Running on visual studio 15 on windows 10 building for a target of windows8 I get the following error.
Unhandled exception at line 79, column 13 in ms-appx://io.cordova.windowsaemscreensplayer/www/cordova.js 0x800a139e - JavaScript runtime error: module cordova-plugin-app-preferences.platform already defined
When I review what get generated in the cordova_plugins.js I find that the same id is used twice which raises the error in cordova.js. { "file": "plugins/cordova-plugin-app-preferences/www/apppreferences.js", "id": "cordova-plugin-app-preferences.apppreferences", "pluginId": "cordova-plugin-app-preferences", "clobbers": [ "plugins.appPreferences" ] }, { "file": "plugins/cordova-plugin-app-preferences/src/platform.js", "id": "cordova-plugin-app-preferences.platform", "pluginId": "cordova-plugin-app-preferences" }, { "file": "plugins/cordova-plugin-app-preferences/src/windows8/platform.js", "id": "cordova-plugin-app-preferences.platform", "pluginId": "cordova-plugin-app-preferences", "merges": [ "" ] },
Cordova.js define = function (id, factory) { if (modules[id]) { throw "module " + id + " already defined"; }