These are chat archives for systemjs/systemjs

6th
Oct 2015
Joseph Kriefall
@joekrie
Oct 06 2015 01:47
Has anyone successfully created an SFX bundle with a React project?
Sean G. Wright
@sgwatgit
Oct 06 2015 02:22
@joekrie just an fyi, they are called Static bundles now https://github.com/systemjs/builder. Unfortunately, I've been working with Angular only.
StrahilKazlachev
@StrahilKazlachev
Oct 06 2015 08:31

Is there a way to map a package dependency to some other version?

"github:aurelia/route-recognizer@0.7.0": {
      "aurelia-path": "github:aurelia/path@0.9.0",
      "core-js": "npm:core-js@0.9.18"
    }

npm:core-js@0.9.18 => npm:core-js@1.2.1

Guy Bedford
@guybedford
Oct 06 2015 10:51
@StrahilKazlachev you can just change the version in the config file then run jspm install.
note this is specifically a SystemJS chat, for jspm discussion see https://gitter.im/jspm/jspm
StrahilKazlachev
@StrahilKazlachev
Oct 06 2015 10:52
I was wondering if there was a way to "re-map" it.
Oops, mixed the chats.
Sorry.
Peter Müller
@Munter
Oct 06 2015 11:02
@guybedford We've been struggling with SystemJS in a node environment, so we wanted to add some test cases to show the problems we encounter. But I can't seem to locate any tests that are actually running in a node environment. Is this something we should help start up?
Guy Bedford
@guybedford
Oct 06 2015 11:04
@Munter the qunit tests are run in Node via npm test
Peter Müller
@Munter
Oct 06 2015 11:04
Our end goal is to be able to test systemjs modules in node with mocha and jsdom, and to have istanbul intrumentation working
Guy Bedford
@guybedford
Oct 06 2015 11:05
there aren't any jsdom tests though
so these cases may be the issue?
Peter Müller
@Munter
Oct 06 2015 11:08
The makefile seems to just run tests in a browser, so actually not in a node environment
It's not that we really want jsdom in the mix if we can avoid it. But it seems that we can't get around that part
Guy Bedford
@guybedford
Oct 06 2015 11:11
@Munter npm test will run qunit -c s:./index.js -t ./test/test-babel.js
yes running jQuery in Node won't work otherwise
AMD tests are definitely covered above
so I think this is jsDOM + jQuery specific, and just about getting to the isolated issue
actually I think I know what it is
if the script onload is not a sync callback in jsDOM
then that would explain it
Peter Müller
@Munter
Oct 06 2015 11:14
There's more than that. Loader plugins don't seem to be evaluated. Commonjs not getting picked up etc
We're also failing on getting non-jQuery paths up and running
Domenico Matteo
@dmatteo
Oct 06 2015 11:15
I can add that it's not only jquery that it's showing up that error
Every AMD module I've tried to import showed up with the same error
Peter Müller
@Munter
Oct 06 2015 11:16
If there is something different about the way jsdom does script loading then I'd be happy to look into that so we can enable people to test in a simpler way
Domenico Matteo
@dmatteo
Oct 06 2015 11:19
We shouldn't need to inject the scripts in JSDOM at all.
Just instantiating a jsdom instance and leaking it as a global should be enough to work with, if System.importis working properly in node
that last part seems a bit flaky (or misconfigured)
As far as I understood, SystemJS relies on some browser globals (e.g. location), and I've updated jsdomify to fully support the use case, leaking all the necessary stuff
Guy Bedford
@guybedford
Oct 06 2015 12:00
@Munter try making this if statement true in jsdom - https://github.com/systemjs/systemjs/blob/master/dist/system.src.js#L1343
I expect that will solve your issues
(note that Node execution is different as we use the vm implementation)
Domenico Matteo
@dmatteo
Oct 06 2015 12:07

Adding

  window.chrome = {
    extension: true
  };

works

as isBrowser is already true
we could add a check for navigator.userAgent === 'node.js' to that condition
vectom
@vectom
Oct 06 2015 19:56

Hi, I import my application scripts like this:

<script src="lib/traceur-runtime.js"></script>
<script src="lib/system.js"></script>
<script>
    System.config({
        baseURL : './src',
        defaultJSExtensions : true
    });
</script>
<script src="lib/angular2.min.js"></script>
<script src="lib/custom.js"></script>
<script>
    // TODO: myFunction(ng2)
    System.import('my-app');
</script>

Could someone please tell me how to create a reference to Angular2 library, so I can pass it to myFunction and use it there?

Here's a snippet from custom.js, which is imported in the code above:

function myFunction(ng2) {
    _ng2 = ng2;
    // ...
    _ng2.Component({
        selector: 'my-component'
    })
    // ...
}

I tried:

System.register(["angular2/angular2"], function (ng2) {
    myFunction(ng2);
});

But that throws "Uncaught TypeError: Unexpected anonymous System.register call".

Jiri Spac
@capaj
Oct 06 2015 23:35
@guybedford how can I get importers of a module? I have found that systemjs stores them in an array(https://github.com/systemjs/systemjs/blob/9ed38dd94f52eefa1b623d8c2b8623a92b480b2a/lib/register.js#L324)-how can I access that array?