These are chat archives for systemjs/systemjs

23rd
Apr 2016
Alexander Wong
@awwong1
Apr 23 2016 05:06
Hello everyone! Is there any documentation for how to use SystemJS with nodejs? The little blurb at the bottom of the README isn't too helpful
I have the following code
#index.ts
"use strict";

import * as System from "systemjs";

System.import("./app.js").then(function(m: any): void {
  console.log(m);
});
typescript compiles it, but when I try to run it in node it throws a reference error saying System is not defined
Juan Lucha
@Ravencrow
Apr 23 2016 17:32
Hello there!
This is my systemjs config:
System.config({
        packages: {
          app: {
            format: 'register',
            defaultExtension: 'js'
          },
          'node_modules/redux-localstorage': {
            format: 'cjs',
            defaultExtension: 'js'
          }
        },
        map: {
          'redux': 'node_modules/redux/dist/redux.js'
        }
      });
      System.import('app/app')
            .then(null, console.error.bind(console));
As you can see, there is a mapfor redux and it works.
It works because is a single js file
But, redux-localstorage is a bunch of js files.
I can't make it import in my project
How can I "map" to a folder with different files in it?
thanks for your answers
Guy Bedford
@guybedford
Apr 23 2016 19:23
@Ravencrow map: { 'redux-localstorage': 'node_modules/redux-localstorage' }, then set a main in the package configuration