JavaScript Modules

  • Hi Team,

    I'm so excited for the JS features, however all of the JS that I want to run is available in external npm modules e.g.

    import { XXX } from 'SomeNPMPackage';

    Any news on when this will be available? This is a game changer for me.

    Thanks

    Warrick

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Support for modules is separate to support for NPM. You can already use dynamic imports in browsers that support it. However NPM cannot be directly supported in a browser - you need to use browser-bundled versions of the modules for that, which you could import as files to the project.

  • I see, so if I'm understanding correctly. Modules are generally used when there's some form of transpiler involved, like WebPack or Babel.

    In order to use these projects that export functionality as CommonJS / ES5 type modules I guess these need to go through a transpiler and then through something like browserify.org ?

  • I see, so if I'm understanding correctly. Modules are generally used when there's some form of transpiler involved, like WebPack or Babel.

    No, modules are different to transpilers.

  • yes I understand they are different things. My point is that in most cases where you're working on a web project that does make use of modules, the module goes through some process before it'll work in a web browser. Babel being the most common .. and what you're saying is that modules need to be pre-processed using something like Babel or Browserify before including them into your Construct project so that they are web browser friendly. Am I understanding that correctly?

  • My point is that in most cases where you're working on a web project that does make use of modules, the module goes through some process before it'll work in a web browser.

    No, not with JavaScript modules.

    what you're saying is that modules need to be pre-processed using something like Babel or Browserify before including them into your Construct project so that they are web browser friendly.

    Yes, with NPM modules, which (currently) don't work the same as JavaScript modules.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)