These are chat archives for systemjs/systemjs

31st
Aug 2015
Jon Stevens
@lookfirst
Aug 31 2015 01:34
HOLY SHIT, this is brilliant. http://polyfills.io/
Eyal Solnik
@eyalsk
Aug 31 2015 03:27
@Zoltu you can use Scala? haha
Micah Zoltu
@MicahZoltu
Aug 31 2015 03:27
I've been looking into Scala.
It looks better than Java as far as Syntax goes, and I'm generally a fan of the stuff from TypeSafe.
Eyal Solnik
@eyalsk
Aug 31 2015 03:28
Haven't done it myself yet but I'm going to soon!
Yeah Java gah... the amount of things I can say about it lol
A. Matías Quezada
@amatiasq
Aug 31 2015 13:43
hi guys, I may need some help here, I'm trying to configure my project to run on the fly with systemjs & babel but I'm getting issues with file extensions
for example I execute System.import('/my-app/app') it fails because it requests /my-app/app without extension
but if I execute System.import('/my-app/app.js) it fails because it requests /my-app/app.js.js :\
does anyone have a clue about what may I've been doing wrong?
A. Matías Quezada
@amatiasq
Aug 31 2015 13:49
I've tried adding "paths": { "*": "*.js" } to the config but it makes no difference
Aviel Fedida
@avielfedida
Aug 31 2015 17:39
Hi eveyone, I recently noticed that when systemjs used to load angular2 apps(maybe other types apps) there is a use of System.import('app').catch(console.log.bind(console));, is there an explanation for the .catch(console.log.bind(console));?
Erik Schilling
@Ablu
Aug 31 2015 18:19

Hello. I am trying to compile typescript files into a single file and load it using systemjs. I am running a gulp build doing:

gulp.task('js', function () {
    return gulp.src(PATHS.src.js.concat(PATHS.typings))
        .pipe(sourcemaps.init())
          .pipe(typescript({
              sortOutput: true,
              noImplicitAny: true,
              module: 'system',
              target: 'ES5',
              emitDecoratorMetadata: true,
              experimentalDecorators: true,
          }))
          .pipe(concat('my-app.js'))
          //.pipe(uglify())
        .pipe(sourcemaps.write('maps/'))
        .pipe(gulp.dest('dist'));
});

Which results in a file like this:

System.register([], function(exports_1) {
    var Test, test;
    return {
        setters:[],
        execute: function() {
            Test = (function () {
                function Test() {
                    this.property = 'SDFDSFA';
                    console.log('Some logging');
                    debugger;
                }
                Test.prototype.someMethod = function () {
                    console.log('inside method');
                    debugger;
                };
                return Test;
            })();
            exports_1("Test", Test);
            test = new Test();
            test.someMethod();
            debugger;
        }
    }
});

System.register([], function(exports_1) {
    var Test2, test2;
    return {
        setters:[],
        execute: function() {
            Test2 = (function () {
                function Test2() {
                    debugger;
                }
                return Test2;
            })();
            exports_1("Test2", Test2);
            test2 = new Test2();
        }
    }
});

//# sourceMappingURL=maps/my-app.js.map

But if i load that using systemjs I get: Uncaught TypeError: Multiple anonymous System.register calls in the same module file.. Any idea how I can achieve this?

Jiawei Li
@jiaweihli
Aug 31 2015 18:33
@avielfedida
@
Jiawei Li
@jiaweihli
Aug 31 2015 18:39
@Ablu I ran into the same issue a few weeks ago, typescript support isn't very good though yet
why are you trying to use systemjs? are you migrating off an old build system, or is this a new project?
are you trying to avoid circular dependencies?
Erik Schilling
@Ablu
Aug 31 2015 18:40
@jiaweihli well mainly because systemjs is used in all angular projects
I am not even sure what I really need systemjs for to be honest...
Jiawei Li
@jiaweihli
Aug 31 2015 18:41
you need some tool to build your typescript, and systemjs ideally helps you avoid circular dependenices
that's what I see as the main benefit
unfortunately it doesn't really work with typescript yet, so your options are to transpile your typescript into ES6, then compile your ES6 into ES5 via systemjs
or use a different build system
I was trying to use systemjs to load in typescript compiled to ES5, but it was failing with the exact same error you got above
(I was trying to avoid circular dependency issues)
I ended up staying with my old build system and using ES6 style imports, which seemed to alleviate a lot of the dependency issues
Erik Schilling
@Ablu
Aug 31 2015 18:59
@jiaweihli thanks for your input. I guess I need to understand this typescript modules output type a bit better...