Search code examples
cordovacross-platformconfigcordova-pluginsplatform

Cordova plugin config.xml UWP (windows platformId)


I am developing Cordova plugin for UWP (Windows Universal) platform, and I've got this issue:

When I declare global js-module I cannot add windows platform because module redefinition, this is the error I get:

0x800a139e - JavaScript runtime error: module some-module-name already defined

config.xml content :

<js-module src="www/some-file.js name="some-name">
  <clobbers target="window.test" />
</js-module>

<!-- android -->
<platform name="android">
 ....
</platform>

  <!-- ios -->
  <platform name="ios">
    ...
  </platform>

<!--windows-->
  <platform name="windows">
    <js-module src="src/windows/some-file.js" name="some-name">

So far, the only solution that I can think of is to add js-module for each platform explicitly.

config.xml content :

<!-- android -->
<platform name="android">
  <js-module src="www/some-file.js name="some-name">
    <clobbers target="window.test" />
  </js-module>
</platform>

    <!-- ios -->
      <platform name="ios">
        <js-module src="www/some-file.js name="some-name">
           <clobbers target="window.test" />
         </js-module>
      </platform>

    <!--windows-->
      <platform name="windows">
        <js-module src="src/windows/some-file.js" name="some-name">

Is there a way to add a global js-module with windows platform? Thanks


Solution

  • I got it, the problem was with clobber - removing clobber from js-module

        <platform name="windows"> 
           <js-module>
    ...
    

    solves it. :)