These are chat archives for systemjs/systemjs

21st
Mar 2016
λex Vincent
@alexisvincent
Mar 21 2016 09:36
Does anyone know why I might be getting this issue after upgrading to jspm 17
the .js.json seems fishy
MCKRUZ
@MCKRUZ
Mar 21 2016 13:49
Ok potentially dumb question here but…what is the difference between a System.import(‘blah blah blah’) and the typescript import { foo } from ‘blah blah’?
Vojtech Polivka
@vojtapol
Mar 21 2016 14:12
Searched the docs for a while but I can not seem to figure out what sort of promise the System.import() function actually returns.
What does this do and why do I want it? .then(null, console.error.bind(console));
MCKRUZ
@MCKRUZ
Mar 21 2016 14:14
What do you mean “what sort of promise”? the System.Import has to bring back a promise becuase it’s loading a module asychronously. The .then is there so you can load a subsequent module or do error recording
is that what you mean
?
Vojtech Polivka
@vojtapol
Mar 21 2016 14:20
@MCKRUZ yeah thats what I mean, so why do I have to bind the error output to the console? isnt that done by default?
And to your question, I think when you use the typescript import, you basically build a dependency tree, that SystemJS then resolves automatically. If you used System.import() you would have to make sure you are importing everything in the right order and chain the promises accordingly.
MCKRUZ
@MCKRUZ
Mar 21 2016 14:22
good question, I “think” it will. but I think that is more provided for you as an example of you being able to do something to the error that comes back. the easiest example to show is just a console output.
cool thanks :-)
Vojtech Polivka
@vojtapol
Mar 21 2016 14:24

being able to do something to the error that comes back

What do you mean by an error that "comes" back? I don't see any variable from the promise that is being used there, that's why I asked about what sort of promise the call returns. aka what is the 'payload' of the promise.

Jason Jarrett
@staxmanade
Mar 21 2016 14:25
.then(null, console.error.bind(console)); is similar to doing .then(null, function(err){ console.error(err); /* now do something with the err */ });
MCKRUZ
@MCKRUZ
Mar 21 2016 14:26
yes stax beat me to it. Simply make it so the function coming back takes in a variable and then it will directly inject it
Vojtech Polivka
@vojtapol
Mar 21 2016 14:27
@staxmanade oh ok, I forgot this bit of vanilla JS, thanks
Jason Jarrett
@staxmanade
Mar 21 2016 14:27
:thumbsup: no problem
Gregg Roemhildt
@roemhildtg
Mar 21 2016 15:38
Having some trouble loading a dojo app with systemjs/stealjs. Anyone here have experience with this? I'm getting errors trying to load files that are imported with dojo plugins like dojo/text xstyle/css and dojo/nls.
I tried configuring the plugin loader but it doesn't seem to be working as is:
  "system": {
    "map": {
      "text": "dojo/text.js",
      "nls": "dojo/nls.js",
      "put-selector": "put-selector/put",
      "css": "xstyle/css.js"
    },
    "meta": {
      "*.html": {
        "loader": "text"
      },
      "*nls*": {
        "loader": "nls"
      },
      "*.css": {
        "loader": "css"
      }
    }
  }
Matthew James Davis
@davismj
Mar 21 2016 19:42
:point_up: March 18, 2016 9:39 PM is this just not a thing systemjs does?
Dominic Watson
@intellix
Mar 21 2016 20:14
anyone got examples of including node_modules of any kinds of module? I'm using TypeScript and am trying to include a CJS module but am really scratching my head how to get it to load in all the files :S
Not sure if using TS changes the story? can't find anything on Google and I'm sure it's so common
not sure if I should be asking in here or in the TS room
Gion Kunz
@gionkunz
Mar 21 2016 20:17
@intellix you can use meta to specify a different module format but usually SystemJS will detect the correct module format automatically if I'm not mistaken
Dominic Watson
@intellix
Mar 21 2016 20:17

I added this:

System.config({
  map: {
    "generic-relay": "vendor/generic-relay/src/RelayPublic.js"
  }
});

which pulled in the file correctly, but RelayPublic.js included extra like: require('x') and it tried to pull them via XHR

Gion Kunz
@gionkunz
Mar 21 2016 20:19
You need a mapping for all dependencies too I guess. Probably better to use JSPM to do that for you right?
jspm install npm:generic-relay
Dominic Watson
@intellix
Mar 21 2016 20:19
hmmm, using angular-cli and saw some people moaning about JSPM. Not sure why... can check it out I suppose
JSPM will create the SystemJS config for me so I can see how I should be doing it?
Gion Kunz
@gionkunz
Mar 21 2016 20:22
nah.. JSPM is perfectly fine :-) It's just managing your dependencies by generating your config.js. Also it's a CLI for bundling using systemjs builder.
I'm using is for a lot of Angular2 stuff
however, can't tell how nice it plays with angular-cli
wouldn't see any obvious conflict there though
Dominic Watson
@intellix
Mar 21 2016 20:26
just searched through the issues on angular-cli GH and see nobody against JSPM, I guess it just wasn't integrated yet
thought I saw someone saying it wasn't good, must have been mistaken :D
Gion Kunz
@gionkunz
Mar 21 2016 20:27
always these prejudices :D
JSPM is really awesome
module loader polyfill <- SystemJS <- JSPM
Dominic Watson
@intellix
Mar 21 2016 20:27
will look back into it again... feel like I know nothing about module loading :S I missed the nodeJS scene as I was busy in a PHP API at the time
Gion Kunz
@gionkunz
Mar 21 2016 20:28
JavaScript fatigue :D
Matthew James Davis
@davismj
Mar 21 2016 20:37
I've added a stack overflow bounty to my question, in case anyone might be able to find an answer!
http://stackoverflow.com/questions/36096632/how-can-i-namespace-a-systemjs-bundle
Gion Kunz
@gionkunz
Mar 21 2016 20:40
@davismj bundle arithmetic can't help in your case? Do you have control over the bundling of A and B? https://github.com/systemjs/builder#bundle-arithmetic ?
Matthew James Davis
@davismj
Mar 21 2016 20:44
yes i do
but will that avoid naming collisions?
Gion Kunz
@gionkunz
Mar 21 2016 20:44
no it will extract shared modules
Matthew James Davis
@davismj
Mar 21 2016 20:44
can i include the source of main.js without system.registering it?
ah, no they could be totally separate files.
i'm building a product that my customer will be able to develop with, and so i have no idea what they will name their modules.
i only want to create a build task which they can use to bundle their app and basically they can then include the bundle and the bundle will export a single member
Martin O'Grady
@grady-lad
Mar 21 2016 22:36
/home/mogrady/workspace/paradox/riskmgmt-cockpit3-frontend/node_modules/systemjs/dist/system.src.js:1433
    if (!(window.chrome && window.chrome.extension || navigator.userAgent.match(/^Node\.js/)))
Anyone run into the above error when running jsdom with systemjs?
Martin O'Grady
@grady-lad
Mar 21 2016 22:43
or has anyone have an example of testing react components with system.js , jsdom and mocha?
Randall Harmon
@rjharmon
Mar 21 2016 22:45
I don't see an error there @grady-lad