These are chat archives for systemjs/systemjs

29th
Mar 2016
Luke
@lukeautry
Mar 29 2016 02:55
Alright guys, I have a pretty weird question/request here. I'd like to set up a configuration that forces systemjs to ignore certain paths. I think this is a rare case, but I'm working on a new workflow where it kind of makes sense.
As in, deps are registered as ["one","two","three"], and I want to say "when you see 'three'" just don't load anything and pretend nothing happened".
Thomas Sieverding
@Bajix
Mar 29 2016 02:57
Use map: { one: ‘@empty’ }
Luke
@lukeautry
Mar 29 2016 02:57
That's definitely a solution, but I'd like to be able to do it for a whole directory with wildcards - doesn't seem like map supports that, only meta does.
Thomas Sieverding
@Bajix
Mar 29 2016 02:57
People do what you’re talking about all the time, usually for making apps that are isomorphic and need a shimmed dom
You can use map to swap directories
You can also swap dependencies, which would generally be how you’d go about having two independent dependency trees
You haven’t described anything new
Luke
@lukeautry
Mar 29 2016 03:00
I'm glad this is a more common use case then I thought, then.
Thomas Sieverding
@Bajix
Mar 29 2016 03:00
Yea, CanJS uses that technique all the time
can/util/library loads up jQuery/MooTools/YUI/Zepto
They use config to accomplish that
SSR as well to create a virtual dom
Luke
@lukeautry
Mar 29 2016 03:01
Can you expand on swapping dependencies?
Thomas Sieverding
@Bajix
Mar 29 2016 03:02
builder.config({
  packages: {
    can: {
      map: {
        './util/util': './util/domless/domless'
      }
    }
  },
  meta: {
    jquery: {
      format: 'global',
      exports: 'jQuery',
      deps: [
        'can/util/vdom/vdom'
      ]
    }
  },
  map: {
    stache: 'can/view/stache/system'
  }
});
util would normally point towards jQuery
Luke
@lukeautry
Mar 29 2016 03:03
Got it, that makes sense.
Thomas Sieverding
@Bajix
Mar 29 2016 03:06
Essentially, vdom/vdom initializes window/document/navigator/location etc into the global namespace, such that jQuery builds onto a fake DOM
dynamic deps like this is generally preferable to conditional deps
Food for thought
Jeff
@Jefftopia
Mar 29 2016 13:31
Is "overrides" a child of "jspm" in the package.json?
Jeff
@Jefftopia
Mar 29 2016 14:27

@laurelnaiad Just wanted to say thanks for the snippets and help yesterday. I carefully went back to these comments and using a few of your patterns I managed to cut back the number of dependencies loaded by ~half and avoided some other headaches.

I can proceed going full-JSPM now. Only script tag is for System JS, which is ideal.

Daphne Maddox
@laurelnaiad
Mar 29 2016 14:46
@Jefftopia great!