These are chat archives for systemjs/systemjs

6th
Sep 2015
Sean Anderson
@MeoMix
Sep 06 2015 05:53

I've got:

import 'analytics';

meta: {
    "analytics": {
        "exports": "ga",
        "format": "global"
    }
},

map: {
    "analytics": "https://www.google-analytics.com/analytics.js",
}

When I try to bundle I get an error saying: "Unable to calculate canonical name to bundle https://www.google-analytics.com/analytics.js".

I need to be able to add "analytics" to an ignore list for bundling. I've tried putting "ignore": true in both config.js and package.json, but doesn't seem to have any effect. Is there another way to do it via config?

Guy Bedford
@guybedford
Sep 06 2015 07:24
@MeoMix you can use the build: false meta option for this
Sean Anderson
@MeoMix
Sep 06 2015 07:25
And that goes into config.js?
meta: {
    "analytics": {
        "exports": "ga",
        "format": "global",
        "build": false
    }
},
Doesn't appear to have any impact. That's in my config.js
Guy Bedford
@guybedford
Sep 06 2015 08:15
Are you still getting the same message?
Sean Anderson
@MeoMix
Sep 06 2015 08:15
Yes
Lemme mess with it in isolation once I finish this other task
Guy Bedford
@guybedford
Sep 06 2015 08:16
right, I think you need to add a build-mapping to @empty as well
builder.loader.config({ map: { analytics: '@empty' } })
perhaps this should be handled through another trace: false build metadata rather
Sean Anderson
@MeoMix
Sep 06 2015 08:17
Yeah. That's what I was reading in the docs, but I was curious as to where that would take place. Currently I'm bundling via shell command. Should I change that to a grunt task that loads the builder? Or ?
Guy Bedford
@guybedford
Sep 06 2015 08:17
yeah it's advised with jspm to run the build via new require('jspm').Builder
ideally there would be a jspm-gulp for this
Sean Anderson
@MeoMix
Sep 06 2015 08:18
Alrighty. I'll take a shot at doing it that way. Just wanted to make sure before going down that road only to find it was a config setting
I will say though -- so nice to not have to do a crazy r.js config file to bundle everything. Pretty much just works right out of the box
Guy Bedford
@guybedford
Sep 06 2015 08:24
yeah, a lot of the lessons came from that
There's systemjs/builder#269 which would cover this sort of case more easily
Sean Anderson
@MeoMix
Sep 06 2015 08:29
Yep that's exactly what I wanted
Cool :+1:
Also thanks a lot for hunting down that regex bug so quickly. I thought I was going crazy trying to debug why my stuff wasn't working and why it was getting worse when I commented things out. :D
Per Hornshøj-Schierbeck
@Hojou
Sep 06 2015 10:27
i'm trying to load an html file with systemjs but i can't figure out if it's supported or not - am i supposed to use a different loader? what about the raw loader - am i missing something, there are support for a lot of wierd file formats, but i don't see html. i must be missing something?
λex Vincent
@alexisvincent
Sep 06 2015 10:40
@guybedford In your oppinion, would it be possible to completely implement the above mentioned npm loader via a loader extension?
Sharon (Sean) Rolel
@Mosho1
Sep 06 2015 12:54
do I need anything other than opts.sfx when trying to compile sfx modules with builder.buildTree? The output I'm getting is in the right direction, but only has obfuscated $__System's
Guy Bedford
@guybedford
Sep 06 2015 13:19
@MeoMix sure, thanks for finding that!
@Hojou you can use the text plugin for this - https://github.com/systemjs/plugin-text
@alexisvincent the next version of SystemJS actually comes with some improved handling for loading node_modules, you may want to have a look at https://github.com/systemjs/systemjs/issues/756#issuecomment-137788516 which discusses node_modules style configs for SystemJS 0.19
(not yet released)
but yes a normalize hook is all that is needed to implement the complete node resolution algorithm, but the issue is that it will conflict with SystemJS's current resolution algorithm
@Mosho1 the $__System is obfuscated on purpose in sfx builds. You shouldn't need to have code that references System though?
Sharon (Sean) Rolel
@Mosho1
Sep 06 2015 13:36
@guybedford I have a trace that I create, and I want to build its trees as an SFX module. I set opts.sfx to true in the call to buildTrees but the only difference in the result is that System.register changes to $__System.register
since then I noticed this isn't really supported and I had to add a bit of code to pass entryPoints as well
once I added that it seems to be working. Is there a way that I can do this currently?
Guy Bedford
@guybedford
Sep 06 2015 13:47
@Mosho1 yes the trace is different for sfx
I'd suggest posting an issue for this trace-style build of sfx
@Mosho1 created systemjs/builder#302
Sharon (Sean) Rolel
@Mosho1
Sep 06 2015 13:51
nice! I can try a PR if I get it to work well enough
Sharon (Sean) Rolel
@Mosho1
Sep 06 2015 15:54
@guybedford what does format: 'defined' mean?
I'm seeing it on nodelibs-process which makes it not show up in the bundle, although it's needed