These are chat archives for systemjs/systemjs

18th
Jul 2016
Thomas Sieverding
@Bajix
Jul 18 2016 03:58
@vsviridov Thank you sir! I’ll look into how they do it… doesn’t seem to do array buffers but maybe there’s something I can glean
Raj
@getmetorajesh
Jul 18 2016 06:46
In my angular2 app I have a local npm package custom-package which reads a json file(var jsFile=require('./cfg.json') ) within its folder. When I try to start the app its calling ...cfg.json.jsand fails. any suggestion on how to make it work
Peter Müller
@Munter
Jul 18 2016 06:52
Set defaultJsExtensions false in your config and configure a json loader for all patterns ending in .json in your configuration meta section
Raj
@getmetorajesh
Jul 18 2016 06:58
thanks @Munter .. I have changed the defaultJsExtension:false, but not sure how to configure a json loader. I tried adding in the json file inside the map var map = { 'file.json': 'node_modules/package/pathtojson'.
Raj
@getmetorajesh
Jul 18 2016 07:11
cool. I added in meta: { '/**/*.json':{ loader: 'json'} but its returning localhost:3000/json 404
Peter Müller
@Munter
Jul 18 2016 07:42
You need a json loader plugin
EBIA
@webia1
Jul 18 2016 09:54
Is there a tool, which creates the systemjs path/map/package-entries for me?
Raj
@getmetorajesh
Jul 18 2016 10:24
thanks @Munter .. that worked.:)
Peter Müller
@Munter
Jul 18 2016 12:40
@webia1 that tool is jspm
Patrick Westerhoff
@poke
Jul 18 2016 13:49
Hey, I’m trying to use systemjs builder to build a dependencies bundle for my already existing app bundle (built with typescript). So my app bundle has lots of System.register() calls in it, and now I want to build a bundle with systemjs builder for all dependencies of the app. It seems that I cannot import the app bundle though, I keep getting a “TypeError: Cannot read property 'forEach' of undefined” in Trace.getLoadDependencies when I try to call builder.bundle('myapp.js').

My config looks like this:

{
  map: { 'main': 'dist/main.js' },
  packages: { /* all the setups for the dependencies */ }
}

and I run the builder using builder.bundle('main', 'dist/bundle.js')

Patrick Westerhoff
@poke
Jul 18 2016 13:55
From debugging into the builder, it seems that load.deps is null. So how can I tell the builder to actually figure out the dependencies of the packages in my app bundle?
Patrick Westerhoff
@poke
Jul 18 2016 14:18

So, apparently it’s not possible to use existing bundles with systemjs bundler? systemjs/builder#602

Bundling with the builder always requires unbundled inputs though.

Trey Long
@xealot
Jul 18 2016 17:53
Is it possible to include something in the builder outside of the baseDir? Sort of like a symbolic link. Example: Any time you're looking for node_modules really check ../../node_modules or something like that?
Michael Bøcker-Larsen
@mblarsen
Jul 18 2016 18:39
@xealot yes, I do that. But be aware if you use something like node_modules/*/js in your tree arthimetics it gets super slow because there are so many modules in the folder. You'll need to limit it somehow. I build up a limited expresson based on my system config (meta and package) that way the builder does not have to go through the whole node_modules dir
Trey Long
@xealot
Jul 18 2016 18:40
Hrm.
Michael Bøcker-Larsen
@mblarsen
Jul 18 2016 18:40
I can share my code if you want
Trey Long
@xealot
Jul 18 2016 18:40
I'm not currently using the build arithmetic to include/exclude packages, but I'll try to keep that in mind.
It could be helpful, thanks. I'm really just looking for how I can instruct system that node_modules is really HERE. Because when we're serving the application it's virtually served from another location.
Michael Bøcker-Larsen
@mblarsen
Jul 18 2016 18:44
I have assets/js/node_modules and public/js/node_modules that are links to the root node_modules. The one is assets is always there for bundling to production. The one in public is only there when I gulp during development (and all my modules, components are loaded individually—including libs)
Trey Long
@xealot
Jul 18 2016 18:49
Yeah, that sounds like what I need. Just need to know the syntax for modeling that in a systemjs config.
Michael Bøcker-Larsen
@mblarsen
Jul 18 2016 18:54

@xealot https://gist.github.com/mblarsen/9aa8885b724fa2253183c67e2b5aec67

Notes: I keep my bundle config as normal node module so I can change the settings after require('./systemjs.bundle.js') ... The reason for this is that the baseURL is different for bundling and for the web version. Otheriwse they are identical.

Trey Long
@xealot
Jul 18 2016 18:55
makes sense
Michael Bøcker-Larsen
@mblarsen
Jul 18 2016 18:55
Another reason is of course that I need to read meta and packages for the bundling like I said (to optimize).
If you are using ES6 do yourself a favor and use exactly those pluings. I tried quite a few to much head ache. :)
Trey Long
@xealot
Jul 18 2016 19:02
haha