These are chat archives for systemjs/systemjs

16th
Mar 2015
Veaceslav Cotruta
@katrotz
Mar 16 2015 09:34
System.import(moduleName) does not trigger then nor catch methods. I have tried to bundle my project, then unbundle, and now importing from the source does not work :/
Dave Ackerman
@dmackerman
Mar 16 2015 12:12
awesome @lookfirst
Dave Ackerman
@dmackerman
Mar 16 2015 13:58
what's "best practice" for building bundles? I want to use gulp, so that means I should use the system-builder, correct? not jspm?
Dave Ackerman
@dmackerman
Mar 16 2015 14:05
which fails with the jquery error. if I do directly from jspm bundle, it works fine
Adrian Mitev
@amitev
Mar 16 2015 14:06
i'm using jspm-cli with gulp through gulp-shell but would like to hear if there is a better approach
Dave Ackerman
@dmackerman
Mar 16 2015 14:14
ok, fixed up the paths - but now the gulp task just appears to exit
Vladislav Nezhutin
@exe-dealer
Mar 16 2015 14:21
Hello! Is there some example of jasmine browser specRunner with systemjs?
Dave Ackerman
@dmackerman
Mar 16 2015 15:07
the builder*
is there a way to prevent the bundle from injecting CSS?
Adrian Mitev
@amitev
Mar 16 2015 15:13
@dmackerman Have you tried using https://github.com/systemjs/builder#ignore-resources ?
Dave Ackerman
@dmackerman
Mar 16 2015 15:15
saw that, but can that take a glob like *.css?
guess I could try.
Adrian Mitev
@amitev
Mar 16 2015 15:16
give it a try :) (no guarantees)
Dave Ackerman
@dmackerman
Mar 16 2015 15:36
yeah, no dice
        builder.config({
            baseURL: 'build',
            inject: true, // always inject our config with our bundle!
            sourceMaps: true, // no need for source maps on production,
            meta: {
                '*.css': {
                    build: false
                }
            }
        });
Dave Ackerman
@dmackerman
Mar 16 2015 15:45
aha! the answer lies in the plugin-css documentation
buildCSS: false,
seperateCSS: false
Jon Stevens
@lookfirst
Mar 16 2015 17:42

@dmackerman https://github.com/Swimlane/systemjs-route-bundler

This uses the SystemJS bundler. The advantage of a route bundler is that it bundles your app up based on your top level routes. This means that instead of getting a single giant .js file for your entire application, you get one .js file per route and potentially one more that contains your routes shared dependencies. Here is a picture:

/route1
   /dependency1
/route2
  /dependency1

Say you have two routes that both share a dependency. This would give you 3 separate files. Loading /route2 would only load one file if /route1 has already loaded (thanks to browser caching).

By pairing things with the https://github.com/lookfirst/ocLazyLoad-SystemJS-Router, this means that as people click around in your app and load routes, the related files for those routes are loaded as needed. This cuts down on the initial page load greatly and means that if your users don’t need a portion of the app, won’t have to load it.

Vladislav Nezhutin
@exe-dealer
Mar 16 2015 17:59
can somebody explain why indirectional require for parent ../src/somemodule fails when loading from not root directory? https://github.com/exe-dealer/jasmine-systemjs-example
Jon Stevens
@lookfirst
Mar 16 2015 18:04
git clone https://github.com/exe-dealer/jasmine-systemjs-example.git
cd jasmine-systemjs-example
python -m SimpleHTTPServer
http://localhost:8000/root-spec-runner.html

Everything seems to work fine for me:

http://take.ms/G0P5d

i want spec-runner to be in spec directory
Jon Stevens
@lookfirst
Mar 16 2015 18:06
Right, it is trying to load this: 127.0.0.1 - - [16/Mar/2015 11:05:17] "GET /spec/src/greeting.js HTTP/1.1" 404 -
Vladislav Nezhutin
@exe-dealer
Mar 16 2015 18:07
yes. why?
Jon Stevens
@lookfirst
Mar 16 2015 18:18

I think the problem is that you’re trying to load the spec itself through SystemJS.

When you load from the spec folder as your root, you’re loading relative to that folder. ../ doesn’t really mean go up a directory from spec, it means go up a directory from your root. Since root is now /spec, the loader doesn’t really know about anything above that root.

It works from the top level folder because everything is below that folder. If you play around with System.baseURL and System.paths, you’ll see it in the requests that are made to the server.

Vladislav Nezhutin
@exe-dealer
Mar 16 2015 18:32
OOh! baseURL: '../' seems to works! I tried baseUrl earlier and didn't notice that 'rl' must be upper
thank you
Jon Stevens
@lookfirst
Mar 16 2015 18:34
that’s weird, it isn’t working for me…
Jon Stevens
@lookfirst
Mar 16 2015 18:51
oh duh. my bad. I was trying to do this: System.baseURL = '../‘; was reading the wrong docs… https://github.com/ModuleLoader/es6-module-loader/wiki/Configuring-the-Loader#baseurl