Software Archive
Read-only legacy content
17061 Discussions

If using require.js, Simulate mode will not work

CAJazzer
Beginner
675 Views

We use require.js to manage javascript code modules, and we are no longer able to use the XDK in Simulate mode.  The simulate feature uses a javascript file called app-host.js which implements its own 'require' object that lives in the global namespace.  As a result, any calls to require.js will fail. 

0 Kudos
1 Solution
Albertina_D_Intel
675 Views

Hi,

Thanks for reporting this. We are working on releasing a hotfix soon that includes the fix for this issue. But in the meantime, as a workaround you can do the following in your current installation of Intel XDK to patch it and continue working:

1 - Make sure that the XDK is closed, and open the file components/server/simulator/cordova-simulate/src/server/sim-files.js in an editor. According to your operating system, you can find that file in the following path:

  • MAC: /Applications/Intel XDK.app/Contents/Resources/app.nw/
  • Windows: C:\Users\<your-user>\AppData\Local\Intel\XDK\xdk\
  • Linux:
    • Installed as root: /opt/intel/XDK/xdk/
    • Installed as user: ~/intel/XDK/xdk/

2 - Replace the line 142, that looks like this,

var b = browserify({ paths: getBrowserifySearchPaths(hostType), debug: false });

with the following snippet:

var b = browserify({
    paths: getBrowserifySearchPaths(hostType),
    debug: false,
    exports: false, // needed to prevent browserify to override hasExports option by set it to true
    hasExports: false
});

3 - Save the changes, and start the XDK.

This should fix the issue. Please, let us know if you have any trouble on patching it, and if it works for you.

Thanks.

 

 

View solution in original post

0 Kudos
3 Replies
PaulF_IntelCorp
Employee
675 Views

Thanks for the feedback, I'll let the appropriate engineer know.

0 Kudos
Albertina_D_Intel
676 Views

Hi,

Thanks for reporting this. We are working on releasing a hotfix soon that includes the fix for this issue. But in the meantime, as a workaround you can do the following in your current installation of Intel XDK to patch it and continue working:

1 - Make sure that the XDK is closed, and open the file components/server/simulator/cordova-simulate/src/server/sim-files.js in an editor. According to your operating system, you can find that file in the following path:

  • MAC: /Applications/Intel XDK.app/Contents/Resources/app.nw/
  • Windows: C:\Users\<your-user>\AppData\Local\Intel\XDK\xdk\
  • Linux:
    • Installed as root: /opt/intel/XDK/xdk/
    • Installed as user: ~/intel/XDK/xdk/

2 - Replace the line 142, that looks like this,

var b = browserify({ paths: getBrowserifySearchPaths(hostType), debug: false });

with the following snippet:

var b = browserify({
    paths: getBrowserifySearchPaths(hostType),
    debug: false,
    exports: false, // needed to prevent browserify to override hasExports option by set it to true
    hasExports: false
});

3 - Save the changes, and start the XDK.

This should fix the issue. Please, let us know if you have any trouble on patching it, and if it works for you.

Thanks.

 

 

0 Kudos
CAJazzer
Beginner
675 Views

Confirmed.  This patch worked perfectly.  Many thanks.

0 Kudos
Reply