These are chat archives for systemjs/systemjs

13th
Jan 2017
Bret Little
@blittle
Jan 13 2017 01:55
@guybedford outside of manually parsing the load.source string inside the translate hook, is it possible to know the dependencies of a load with a plugin?
Aneesh Kulkarni
@aneesh1992
Jan 13 2017 13:34
hi guys, can anyone guide me on how to load a systemJs angular app on IBM HttpServer
Guy Bedford
@guybedford
Jan 13 2017 13:41
@/all SystemJS 0.20.0-rc.2 is now out at npm install systemjs@next. This pushes in a big break by disabling named imports for legacy modules to align with the NodeJS adoption of ES modules. See https://github.com/systemjs/systemjs/releases/tag/0.20.0-rc.2 for more info, and thanks for feedback so far.
Jeremy Danyow
@jdanyow
Jan 13 2017 15:36
@guybedford I'm making sure Aurelia is compatible with the 0.20 RC and am hitting a strange issue where a property gets redefined with a getter function: https://gist.run/?id=043ac5aa5ba48b52bac9d3b567a22c98
The gist ^^^ is using 0.19 and working. If you uncomment the script tag referencing the 0.20 RC you'll see the issue
Guy Bedford
@guybedford
Jan 13 2017 15:53
@jdanyow thanks for letting me know... that looks like for some reason it is trying to write to a module namespace object, which isn't permitted
it seems like that would be a bug in the aurelia-template library then
urlOrRegistryEntry should be an aurelia registry entry not a Module Namespace object
surely?
Jeremy Danyow
@jdanyow
Jan 13 2017 16:04
@guybedford right- it's supposed to be this class: https://github.com/aurelia/loader/blob/master/src/template-registry-entry.js
which it is, but for some reason a getter is defined on it
Jeremy Danyow
@jdanyow
Jan 13 2017 16:17

@guybedford I'd update the gist with this change but the github api is down:

Switching to system.src.js and adding this snippet helps to debug the issue:

      // break when the "onReady" property is rewritten
      Object.standardDefineProperty = Object.defineProperty;
      Object.defineProperty = function(...args) {
        if (args[1] === 'onReady') {
          debugger;
        }
        return Object.standardDefineProperty(...args);
      };
Guy Bedford
@guybedford
Jan 13 2017 18:02
@jdanyow if you add a debugger to the line that throws originally, you will find that the first two templates are proper template objects, but the third template is a Module Namespace object. What this means is that the third template was created by a System.newModule call somewhere in the module system. So the problem would be with whatever code in Aurelia is generating a module instance to set into the registry from a class instance.
I expect it would be Aurelia calling System.newModule here directly, or returning the direct class from instantiate.
Jeremy Danyow
@jdanyow
Jan 13 2017 18:05
@guybedford much appreciated!
Jeremy Danyow
@jdanyow
Jan 13 2017 18:21

@guybedford changing this line from

      'instantiate': function(load) {
        return load.metadata.result;
      }

to:

      'instantiate': function(load) {
        return { __useDefault: true, default: load.metadata.result }
      }

fixed it.
Is there a better way of doing this?

Jeremy Danyow
@jdanyow
Jan 13 2017 18:27
also, this change doesn't seem to be backwards compatible with SystemJS 0.19
Guy Bedford
@guybedford
Jan 13 2017 20:22
@jdanyow are you sure the approach isn't backwards compatible? What bug are you getting on the backwards compatibility path?
otherwise there may be a fix we can add here for this case
Jeremy Danyow
@jdanyow
Jan 13 2017 22:01

@guybedford you can see the issue here: https://gist.run/?id=d231e4c567d037e6766ca8ceaedbce50

In index.html switch the system script from the 0.20.0-rc.3 to the last 0.19 release.

Here's a screenshot of the issue. On the left is what I get in 0.19 and on the right is what I get in 0.20.
http://i.imgur.com/p5R0crw.png
Only difference between the two sides is the system version used in the gist.