These are chat archives for systemjs/systemjs

8th
Mar 2016
Benjamin Lupton
@balupton
Mar 08 2016 06:42
@guybedford what are your thoughts on https://github.com/bevry/editions - as a successor for https://github.com/bevry/esnextguardian
@guybedford not sure if the "jspm" object should also include "format" for whichever their esnext syntax edition's module format is - or is it optional and auto-detected these days?
Marc Wensauer
@daslicht
Mar 08 2016 07:58
I am trying to use systemjs with node:
test.js

export function doit()
{
    return "done"
}
app.js

System.import('./test.js').then( function(m) {
  console.log('System:', m);

});
but the console .log is never fired , idea why ?
wrong syntax ?
Maxime Veber
@Nek-
Mar 08 2016 08:02
What is your index.html ?
If you use systemjs in es5 (I mean browser JS) it's much more complicated.
if you use a preprocessor, it's more something like import doit from './test';
Marc Wensauer
@daslicht
Mar 08 2016 08:05
as I wrote above, I use it in Node
so my index.html is irrelevant
Maxime Veber
@Nek-
Mar 08 2016 08:06
You don't need systemjs for nodejs usage :o .
Adam Burgess
@adamburgess
Mar 08 2016 08:07

Universal dynamic module loader - loads ES6 modules, AMD, CommonJS and global scripts in the browser and NodeJS

@Nek- you can use it for both

Maxime Veber
@Nek-
Mar 08 2016 08:07
Ok didn't know.
Marc Wensauer
@daslicht
Mar 08 2016 08:07
@Nek- I know , but I wanted to test it how its written in the docs
that way you could use es6 modules in node
Marc Wensauer
@daslicht
Mar 08 2016 08:11
hehe
@AdamBurgess Is it possible to export an es6 class ?
Adam Burgess
@adamburgess
Mar 08 2016 08:13
@daslicht since you aren't using JSPM, you have to set up the config manually
Marc Wensauer
@daslicht
Mar 08 2016 08:14
ouch
let me have a look for classes in jspm
Adam Burgess
@adamburgess
Mar 08 2016 08:15
do an npm install systemjs-plugin-babel and then use this before you import things:
System.config({
  transpiler: 'node_modules/systemjs-plugin-babel/plugin-babel.js',
  packages: {
    'node_modules/systemjs-plugin-babel': {
      map: {
        'systemjs-babel-build': './systemjs-babel-node.js'
      }
    }
  }
});
Marc Wensauer
@daslicht
Mar 08 2016 08:16
why is it possible here to just use the import syntax :
http://jspm.io/0.17-beta-guide/universal-js-with-server-rendering.html
ahh i see its based on teh confix file
Adam Burgess
@adamburgess
Mar 08 2016 08:17
@daslicht because that's using JSPM w/ systemjs
note you can use JSPM (0.17 beta) with node, just write your code as normal and then jspm run main.js
Marc Wensauer
@daslicht
Mar 08 2016 08:19
ahh that was the missing piece, check , you are running it with jspm
do i need any config files ?
Adam Burgess
@adamburgess
Mar 08 2016 08:20
if you install everything via jspm (including npm modules using npm: prefix) then it creates all the config files for you
Marc Wensauer
@daslicht
Mar 08 2016 08:20
cool
ok once i have set it up i can simply do export class Main{} ? in a module ?
Adam Burgess
@adamburgess
Mar 08 2016 08:22
exactly
Marc Wensauer
@daslicht
Mar 08 2016 08:25
nice
will this also work if i add jspm to an existing project ? so that i can keep my regular imports and add new with jspm ?
Adam Burgess
@adamburgess
Mar 08 2016 08:32
I'm not 100% sure of the answer to that ... I think you might still be able to use the require() syntax somehow, but I don't have the answer
Guy Bedford
@guybedford
Mar 08 2016 10:19
@daslicht the first thing to do is to add a catch handler to your import so you can know what the error is!
When detecting an ES module SystemJS will do System.import(System.transpiler) and transpile with that
so you just need to make sure that can resolve