These are chat archives for systemjs/systemjs

20th
Jul 2016
Michael Bøcker-Larsen
@mblarsen
Jul 20 2016 00:00
In my main file (entry point) I include lodash and attach the mixin inflections
Since it is global it is available everywhere
The format in meta is not a command to make it global but rather telling what module format is used. So using es6 format I'm not sure how you make things global that way.
Abhisek Pattnaik
@abhisekp
Jul 20 2016 08:13
@mblarsen cud u plz check mine? http://www.hastebin.com/nuwadatoxa.js
I still see that my modules need extension while importing
and my globals are not globals
Michael Bøcker-Larsen
@mblarsen
Jul 20 2016 08:59
I'm out at the moment will check later @abhisekp
@abhisekp in meta you should refer to paths not packages
Abhisek Pattnaik
@abhisekp
Jul 20 2016 11:07
@mblarsen but my paths are written in map
Jeff
@Jefftopia
Jul 20 2016 13:12
Is there a difference between loadConfig and the config passed to a builder instance?
in the SystemJS stand-alone builder
Jeff
@Jefftopia
Jul 20 2016 13:30
Where do I tell system config where to locate the typescript transpiler? Do I map it with my other project dependencies?
Axel Dolce
@dolchi21
Jul 20 2016 14:14
hey guys, question here. does SystemJS save the imports so that if a package is "imported" again it doesn't have to make the ajax call? Or it fetches the js file everytime import is executed?
i tried importing multiple times with the console and it seems only one ajax call was made. so, as far as i know, it is saving the module for reuse. am i right?
Michael Bøcker-Larsen
@mblarsen
Jul 20 2016 14:40
@abhisekp yeah I know that but that is not how it reads the meta
Peter Müller
@Munter
Jul 20 2016 15:45
@dolchi21 already downloaded modules are cached locally
André Werlang
@awerlang
Jul 20 2016 17:01
can SystemJS builder resolve modules like import * from './moduleA' to ./moduleA/index.ts?
Jeff
@Jefftopia
Jul 20 2016 18:11
I used system js to build my js. now when I import the bundled file into the index page, nothing happens. The file is found, but the application doesn't 'launch' What am I missing?
Adam Burgess
@adamburgess
Jul 20 2016 18:39
@Jefftopia you have to System.import('some-file-in-the-bundle.js') - i.e. an entrypoint
Jeff
@Jefftopia
Jul 20 2016 18:43

@adamburgess Okay, so, for example, System.import('app/main.js')? I don't need to map the file-to-be-imported, right?

Also wanted to ask how to work with templates. I did a static bundle that almost worked, but template locations are off now.

Adam Burgess
@adamburgess
Jul 20 2016 18:44
@Jefftopia if app/main.js exists, then sure. if it isn't in the bundle, it'll still load it over the net
Jeff
@Jefftopia
Jul 20 2016 18:49
@adamburgess Hmm. I'm doing something wrong...here's what I've got.
  var map = {
    'app':                        'dist',
...
  };
  var packages = {
    'dist':                       { main: 'loghub',  defaultExtension: 'js' },
      System.import('app/main.js')
The original 'file-in-the-bundle' was loghub/main.js
Jeff
@Jefftopia
Jul 20 2016 18:56
I also tried commenting out those map and packages lines, and just importing dist/main.js, but no dice.
Adam Burgess
@adamburgess
Jul 20 2016 18:58

'dist': { main: 'loghub', defaultExtension: 'js' },

this means the dist (or app) folder's main file is loghub.js
you're calling System.config({map: map, packages: packages}) before the import, right

Jeff
@Jefftopia
Jul 20 2016 18:59
Correct, I'm loading the config first. dist is where I output the bundle. dist contains loghub.js - the bundle.
Adam Burgess
@adamburgess
Jul 20 2016 19:00
oh, alright
you're doing it wrong
Jeff
@Jefftopia
Jul 20 2016 19:02
:P
Adam Burgess
@adamburgess
Jul 20 2016 19:02
think of a bundle as just a quicker way to load modules -- without it everything will still work, just slower
a bundle has to be loaded as a normal <script src="dist/loghub.js"></script>
so you still want to import loghub/main.js
Jeff
@Jefftopia
Jul 20 2016 19:04
@adamburgess ah, nice. works perfect now, thanks.
Adam Burgess
@adamburgess
Jul 20 2016 19:08
goody
I had a quick look at systemjs and the builder docs, and it wasn't obvious at all that this is how bundles work. it's mentioned in other places (like for jspm - http://jspm.io/0.17-beta-guide/bundling.html ) but not specifically for systemjs; it could probably be improved
Jeff
@Jefftopia
Jul 20 2016 19:12
@adamburgess Agreed. The system-builder docs specifically were sparse. I should have looked at JSPM.
Adam Burgess
@adamburgess
Jul 20 2016 19:13
@Jefftopia make sure to look into self-executing bundles for the final product (if you don't need dynamic imports). then you dont need to load systemjs/the config/import the file, just include one script and you're done
Jeff
@Jefftopia
Jul 20 2016 19:16
I'm looking into it now actually. It's pretty nice except that the html templates I'm using are one directory below where the request is made from.
ie they're in src/loghub/... but the request is from loghub
Jeff
@Jefftopia
Jul 20 2016 19:34
Can you not bundle html into the sfx?