Fix to issue 82(cordova-plugin-app-preferences.platform already defined) #83
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixing issue 82, where the following error was showing on windows apps:
0x800a139e - JavaScript runtime error: module cordova-plugin-app-preferences.platform already defined
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):
Platform specific one(plugins/cordova-plugin-app-preferences/src/windows8/platform.js):
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):
Platform specific one(plugins/cordova-plugin-app-preferences/src/windows8/platform.js):