If using require.js, Simulate mode will not work

If using require.js, Simulate mode will not work

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. 

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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

Best Reply

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.

 

 

Confirmed.  This patch worked perfectly.  Many thanks.

Leave a Comment

Please sign in to add a comment. Not a member? Join today