These are chat archives for systemjs/systemjs

25th
Aug 2015
Rob Wormald
@robwormald
Aug 25 2015 01:17
@Mosho1 that really shouldn't happen
Sharon (Sean) Rolel
@Mosho1
Aug 25 2015 08:18
@robwormald It seems to happen a lot more when I turn on depcache
for d3 in this case
Dave Ackerman
@dmackerman
Aug 25 2015 14:49
does systemjs builder support source maps?
also, it seems that when I try to run the bundler from gulp, it’s trying to load the JSPM packages from the root of my machine, not relative to the config?
Peter Müller
@Munter
Aug 25 2015 14:56
You need to use require('jspm').Builder instead of systemjs-builder
That makes sure your paths are correct according to your project directory
Dave Ackerman
@dmackerman
Aug 25 2015 14:57
Oh
Peter Müller
@Munter
Aug 25 2015 14:58
Took me quite some tinkering time plus asking here to know that
Sharon (Sean) Rolel
@Mosho1
Aug 25 2015 14:58
hmm, I use systemjs-builder with gulp successfully
Dave Ackerman
@dmackerman
Aug 25 2015 15:05
@Mosho1: do you mind sharing your task?
and which versions of JSPM/SystemJS/systemjs-builder you’re using?
Sharon (Sean) Rolel
@Mosho1
Aug 25 2015 15:07
latest
beta even
I'll show you in a few minutes
Dave Ackerman
@dmackerman
Aug 25 2015 15:08
appreciate it.
Dave Ackerman
@dmackerman
Aug 25 2015 15:26
once you load the builder, you can’t override the baseURL?
Peter Müller
@Munter
Aug 25 2015 15:27
You can only set baseUrl once. When you load the builder through jspm it loads your config.js, which sets baseUrl
Dave Ackerman
@dmackerman
Aug 25 2015 15:34
ok. I may need to rethink my project structure a bit then. I was previously copying the jspm_modules into a /build folder for dev, but I don’t think I need that...
curious, what do you have your baseURL set to in your config, @Munter?
Peter Müller
@Munter
Aug 25 2015 15:46
"/app/assets/javascripts"
Sharon (Sean) Rolel
@Mosho1
Aug 25 2015 16:16
@dmackerman this is what I do, in general:
let tree = await builder.trace(path, options);
let {source, sourceMap} = await builder.buildTree(tree);
file('bundle.js', source, true).pipe(gulp.dest(destPath));
where file is from gulp-file
I trace several trees and do some stuff with them, then build the results
here I showed with one
the first two lines are the same as builder.build(path) I think
which I originally had that also worked
Dave Ackerman
@dmackerman
Aug 25 2015 16:42
so I got the bundle working, and it’s included in my index.html file - I thought system was supposed to intercept it and determine that it was bundled and not load the dependencies individually?
I used this command: jspm bundle src/app/app.module src/app/bundle.js -m —inject
Sharon (Sean) Rolel
@Mosho1
Aug 25 2015 16:55
inject puts it in your config.js under bundles
it means you don't have to include it in your script
and from there is knows that it's a bundle and fetches it instead
so it's either put it in a script tag, or inject
either way it shouldn't fetch the separate modules
Dave Ackerman
@dmackerman
Aug 25 2015 17:06
so the in the System.import you import the bundle?
Sharon (Sean) Rolel
@Mosho1
Aug 25 2015 17:19
no, the index
any module inside that bundle
if you look in your config.js, you should see the bundle under bundles, with an array list of all its bundled modules
if you import one of those, the bundle should be fetched instead of the modules that are in it
Dave Ackerman
@dmackerman
Aug 25 2015 17:52
hmm. ok
so System.import uses the baseURL as well, hmm
Dave Ackerman
@dmackerman
Aug 25 2015 17:58
so if my import is System.import('./app/app.module’), but in the bundle it’s listed as...
bundles: {
    "src/app/bundle.js": [
      "src/app/app.module.js”,
      …
won’t match, will it :\
Sharon (Sean) Rolel
@Mosho1
Aug 25 2015 19:13
hmm, I think that has to do with defaultJSExtensions
or else it wouldn't bundle them like that...
but I'm really not sure about that
and you need the module's name to import, relative won't work if it's the entry point