Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to issue 82(cordova-plugin-app-preferences.platform already defined) #83

Merged
merged 1 commit into from
Mar 10, 2016

Conversation

pcbl
Copy link
Contributor

@pcbl pcbl commented Mar 2, 2016

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):

    {
        "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": [
            ""
        ]
    },

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):
```
    {
        "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": [
            ""
        ]
    },
```
@apla
Copy link
Owner

apla commented Mar 10, 2016

Hi, thank you for the patch. This is definitely cordova bug: windows and windows8 is different platforms and only one platform.js is needed. I'll accept your patch but I need to investigate little further to make sure everything works fine.

apla added a commit that referenced this pull request Mar 10, 2016
Fix to issue 82(cordova-plugin-app-preferences.platform already defined)
@apla apla merged commit 78a944a into apla:master Mar 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants