These are chat archives for systemjs/systemjs

20th
Dec 2016
Seth House
@whiteinge
Dec 20 2016 02:21

I'm just getting started with SystemJS and trying to figure out how configure it to work with an existing app that uses index.js files and no extension in the import statements. I'm stuck on the various config combinations in the docs and I could really use an example.

What combination of defaultExtension/packages/map settings would allow me to use these two imports as-is?

import foo from './foo';  // corresponds to foo/index.js
import bar from './bar';  // corresponds to bar.js
Seth House
@whiteinge
Dec 20 2016 03:09
Ah ha! Each package req's an explicit main. This works:
    System.config({
        baseURL: '/js',
        packages: {
            '.': {}, // needed to add a default extension to path lookups
            '/js/foo': {main: 'index.js'},
        },
    });
Jake Niemiec
@jakeNiemiec
Dec 20 2016 14:58

One of my apps is bundled with jspm, This is the resulting part of the bundle file I need to load
SystemJS.import("what do I need hear?");
How would I import that part of the bundle?

Do loaded bundle not contain anything? Is it just a reference to a bunch of files that need to be downloaded together?

Peter Müller
@Munter
Dec 20 2016 15:01
What do you mean by not containing anything? You show a screenshot of a file where there is content on lines 91718-91744. I'd say that file contains something
Jake Niemiec
@jakeNiemiec
Dec 20 2016 15:07
@Munter I mean there is no action taken and no errors in the console. I want to run the code within System.register("app/main.js”...
Peter Müller
@Munter
Dec 20 2016 15:08
System.import('app/main') if I recall correctly
Jake Niemiec
@jakeNiemiec
Dec 20 2016 15:09

@Munter

Uncaught (in promise) Error: (SystemJS) __decorate is not defined ReferenceError: __decorate is not defined at execute (http://wy.rb/dist/ww-bundle.js:76865:30) Error loading http://wy.rb/src/main.js at execute (http://wy.rb/dist/ww-bundle.js:76865:30) Error loading http://wy.rb/src/main.js

Tries to load http://wy.rb/src/main.jsinstead of loading it from within the bundle
(wy.rb = localhost)
Peter Müller
@Munter
Dec 20 2016 15:18
Jake Niemiec
@jakeNiemiec
Dec 20 2016 15:21
@Munter yes also I am on .17 so I may be treading upon a bug. I just wanted a sanity check to see if there was nothing obviously wrong.
Thanks for your help, I am looking into the __decorate is not defined at execute It may be the TS not transpiling properly.
Jake Niemiec
@jakeNiemiec
Dec 20 2016 21:38
@Munter (It was typescript fyi 😵)