These are chat archives for systemjs/systemjs

10th
Jun 2015
Robert Sundström
@robertsundstrom
Jun 10 2015 00:37
I have built my own Knockout SPA template with a custom SystemJS-based component loader. Bundling is also setup. http://github.com/robertsundstrom/knockoutjs-express-es6
Mike Haas
@mikehaas763
Jun 10 2015 14:03
Using a baseURL like in the following example does not work because the builder is "Unable to calculate canonical name to bundle file:///Users/mhaas2/projects/community/project/yolo.js"
https://gist.github.com/mikehaas763/73c7fd7acdfb93495540
I like using a baseURL because then I can just reference my inter-app module dependencies as baseURL absolute paths and avoid relative path hell.
Then I just map in external deps. Is it possible to get this working?
Guy Bedford
@guybedford
Jun 10 2015 14:26
@mikehaas763 what you're doing is fine - but the issue is that the path must exist inside the baseURL or one of the wildcard paths for it to be bundleable
Mike Haas
@mikehaas763
Jun 10 2015 14:30
@guybedford Is this a part of the WIP loader spec or just a detail left up to the implementation at this point?
Guy Bedford
@guybedford
Jun 10 2015 14:30
baseURL is a loader implementation detail yes
Mike Haas
@mikehaas763
Jun 10 2015 14:50
I'll just throw it out there with an example of how I personally would like the usage of modules from a developer consumer perspective.
https://gist.github.com/mikehaas763/e294a98b2a8e722e0609
Guy Bedford
@guybedford
Jun 10 2015 14:51
@mikehaas763 I'm not sure what you're asking for here. This is exactly what map configuration is designed for:
System.config({
  paths: {
    '*': 'lib/*',
    'node_modules/*': 'node_modules/*'
  },
  map: {
    "3dMathLib": "node_modules/3dMathLib"
  }
});
Mike Haas
@mikehaas763
Jun 10 2015 14:57
Ok I think that may be what I'm looking for. I previously thought that the only way to avoid the need to specify 'lib/' in my first import was to use baseURL
Guy Bedford
@guybedford
Jun 10 2015 14:57
baseURL can do that, but it acts mainly as a reference URL at this point
(would need to have 'node_modules/*': './node_modules/*' otherwise which could also work)
(corrected)
Mike Haas
@mikehaas763
Jun 10 2015 15:01
That would work if baseURL was set to node_modules parent directory but I don't think it would if it was set to a sibling directory of node_modules. Such as with my example if it was set to lib/
Mike Haas
@mikehaas763
Jun 10 2015 15:07
I think I may create an introductory post or submit a PR to either systemjs or es6-module-loader detailing what you posted above. I suspect that's the way a majority of devs would want to have module loading work from a dev perspective and I don't think I've seen anything yet that made it clear how easy it is to do it with the config you showed me.
Guy Bedford
@guybedford
Jun 10 2015 15:11
paths are resolved relative to baseURL themselves
so I think it would be ../node_modules/* actually
@mikehaas763 this is currently covered in map config in SystemJS docs - any clarifications are welcome
Mike Haas
@mikehaas763
Jun 10 2015 15:15
Right but at least with the builder if I were to do that I believe I would get the "Unable to calculate canonical name to bundle file:///Users/mhaas2/projects/community/project/yolo.js"
Guy Bedford
@guybedford
Jun 10 2015 15:16
No, canonical names are any names which have defined paths rules.
if you load something that does not correspond to a paths rule, then it can't be canonicalized
(paths rule or within baseURL that is)
Mike Haas
@mikehaas763
Jun 10 2015 15:31
Ok thanks for setting me on the right path. As you should be able to see it's confusing for someone who isn't in the depths of the loader. I shouldn't need to be an expert in the configuration or any of the other little details to just get a basic app set up with loading configuration like you showed me so I will hopefully get a chance to add some clarity for others somewhere.
Guy Bedford
@guybedford
Jun 10 2015 15:33
sure, yes SystemJS does draw a clear line in terms of its responsibilities
but improving knowledge around these ideas would be very helpful
Arthur Clemens
@ArthurClemens
Jun 10 2015 16:19
I am using css plugin to dynamically load css per module. When building with systemjs-builder I get all js files bundled, except for those css files. I don’t see an “include css” option in the systemjs-builder docs...
If this is the case, is the workflow: build js in the distribution folder, then copy over the css files?
Guy Bedford
@guybedford
Jun 10 2015 16:32
@ArthurClemens the CSS is inlined into the build.js file
Arthur Clemens
@ArthurClemens
Jun 10 2015 16:32
hmm, I need to check my output then
Arthur Clemens
@ArthurClemens
Jun 10 2015 16:53
no, it does not get included. I’ve tried different build options, but no change.
Guy Bedford
@guybedford
Jun 10 2015 16:59
which version of plugin-css are you using?
Arthur Clemens
@ArthurClemens
Jun 10 2015 17:09
0.1.0
Guy Bedford
@guybedford
Jun 10 2015 17:27
try upgrading to the latest version via jspm update css it should version 0.1.12
Arthur Clemens
@ArthurClemens
Jun 10 2015 17:33
I don’t use jspm
Guy Bedford
@guybedford
Jun 10 2015 17:33
ah right, build support for css is only provided in jspm
Arthur Clemens
@ArthurClemens
Jun 10 2015 17:33
I’ve installed using npm. That says 0.1.0 is the latest.
Guy Bedford
@guybedford
Jun 10 2015 17:33
that npm repo was actually published by a user, and isn't supported
Arthur Clemens
@ArthurClemens
Jun 10 2015 17:33
BTW there is significant difference in npm vs github
aha
Guy Bedford
@guybedford
Jun 10 2015 17:34
the features provided for systemjs only is just css loading dynamically
we could look to support better support for builds for non-jspm users
Arthur Clemens
@ArthurClemens
Jun 10 2015 17:34
I can install from github instead of npm
Guy Bedford
@guybedford
Jun 10 2015 17:35
I've created systemjs/plugin-css#40
It's really not something I can prioritise right now though unfortunately
Arthur Clemens
@ArthurClemens
Jun 10 2015 17:55
thanks
Jami Pekkanen
@jampekka
Jun 10 2015 18:44
Here's a proof-of-concept version of the npm resolver I talked about yesterday: https://github.com/jampekka/system-npmlocator