These are chat archives for systemjs/systemjs

5th
Aug 2016
Gabriel Martinez
@gmartinezk_twitter
Aug 05 2016 14:25
Hi, all.
Can anyone help me with a requirement. I'm using angular2 to build an application that must load components dynamically. I need to do a "require(...)" passing as argument to require a variable, but, when i try to do that the log output "require is not a function", thanks
Jeff
@Jefftopia
Aug 05 2016 14:30
@gmartinezk_twitter The question is pretty unclear, but check your tsconfig .json, make sure you're using modules commonjs.
Gabriel Martinez
@gmartinezk_twitter
Aug 05 2016 14:46
@Jefftopia thanks, sorry for poor explication and also my poooor english. My tsconfig.json has commonjs already. The idea is that I have one application that runs as the container of other apps ( created as angular2 components). The container app must not know about child apps. In fact, this child apps can be created in isolation. The container app must read a configuration file that has for each child app, a path where the module is located. Systemjs load the modules based on that configuration file. I need after do the require based on string variable, in the same manner load the class based on string variable. Thanks and hope you understood me
Gabriel Martinez
@gmartinezk_twitter
Aug 05 2016 16:11
I don't know if this message from @guybedford is the answer for my problem: "Yes we can only load CommonJS modules that are "statically analyzable" in SystemJS. This is because require is not synchronous."
Jeff
@Jefftopia
Aug 05 2016 16:14
@gmartinezk_twitter I'm having trouble following where your problem is. Are you following the Angular 2 Quick-start correctly? It runs just fine out of the box. What are you trying to do that isn't in the tutorial? Make sure you dependencies are up-to-date.

I probably don't know the answer to your question, I haven't used the dynamic component loader class, or whatever it's called.

You should post your question in the Angular 2 Gitter channel, people there might have a better idea.