These are chat archives for systemjs/systemjs

4th
Feb 2016
Valiantsin Luchko
@valichek
Feb 04 2016 08:51

Hey, guys, is there some way to get the path the module is loaded from? Smth like:

System.getPath(‘jqueryui’); // => "/jspm_packages/github/components/jqueryui@1.11.4.js"

Maybe one can suggest the hacking way?

Guy Bedford
@guybedford
Feb 04 2016 09:27
@valichek System.normalize('jqueryui').then(function(normalized) { })
Valiantsin Luchko
@valichek
Feb 04 2016 09:33
@guybedford thx a lot, so simple
André Gaul
@andrenarchy
Feb 04 2016 11:15
hey everyone! is there a way to load a module and expose it as a global variable?
i'm using angular-mocks within karma tests and it expects angular in the global scope
Dobromir Brezoev
@dbrezoev
Feb 04 2016 11:17
@andrenarchy
System.config({
  meta: {
    'vendor/angular-ui-router.js': {
      globals: {
        angular: 'vendor/angular.js'
      }
    }
  }
});
System.import('vendor/angular-ui-router.js');
André Gaul
@andrenarchy
Feb 04 2016 11:17
ideally this would be handled by https://www.npmjs.com/package/karma-systemjs or https://www.npmjs.com/package/karma-jspm but they don't yet support the split configuration of jspm 0.17 (beta)
André Gaul
@andrenarchy
Feb 04 2016 11:30
hmm it doesn't work...
maybe karma loads my files in the wrong order
Manuel Schweigert
@Manuel-S
Feb 04 2016 14:53
hey, I'm probably just dumb again, here goes
I'm trying to do some mapping in my system.config file
I would like to be able to include files from 'foreign/somelib' and map foreign: 'path/to/foreign/files/'
or is that not possible?
Manuel Schweigert
@Manuel-S
Feb 04 2016 15:05
ah I need to use paths?
Karl Purkhardt
@KarlPurk
Feb 04 2016 15:06

yeh I think path's will help here.

 map: {
      "test-path": "/this/is/a/test/path",

with

System.import('test-path/main');

will load /this/is/a/test/path/main.js

Manuel Schweigert
@Manuel-S
Feb 04 2016 15:08
@KarlPurk I tried it with map, which didn't work, but paths does :)
Karl Purkhardt
@KarlPurk
Feb 04 2016 15:09
ah :) That's odd though, map worked as described for me.
Karl Purkhardt
@KarlPurk
Feb 04 2016 15:19
Are others using jspm with SystemJS? I'm new to both SystemJSand jspm and I'm a little confused at the moment. I decided to go with jspm for package management but I'm now having second thoughts. I've noticed that jspm adds so much noise to the config file that it becomes unreadable (I only installed 1 package and my config is now > 300 lines). What are other people doing to manage dependencies? Are other people manually managing their SystemJS configs? Is there a best practice or any advice on choosing an approach?
Manuel Schweigert
@Manuel-S
Feb 04 2016 15:20
right now I am using systemjs with bower, but that is more because of a historical reason at my company
Karl Purkhardt
@KarlPurk
Feb 04 2016 15:21
@Manuel-S so you're updating your SystemJS config by hand?
Manuel Schweigert
@Manuel-S
Feb 04 2016 15:23
@KarlPurk yep, not so much work since bower doesn't do version folder stuff and we also have lots of moving and copying tasks so yeah, it's complicated :D
Manuel Schweigert
@Manuel-S
Feb 04 2016 15:28
but it's still better than what we had before ;)
(all dependencies checked in and a big excel spreadsheet describing where each file came from :D )
Karl Purkhardt
@KarlPurk
Feb 04 2016 15:40
sounds like a nightmare! :) I've decided to drop jspm and instead manually manage my config. At least I'll understand what's in there and why it's there.