These are chat archives for systemjs/systemjs

8th
Jan 2016
Pablo De Nadai
@pablodenadai
Jan 08 2016 10:16
Hi guys, I'm wondering if this setup is inline with what's recommended. https://github.com/ghpabs/angular2-seed-project/blob/master/src/index.html
In Dev (files aren't bundled) I'm loading the app's entry package.
In Prod (files are bundled) I'm loading the app's entry module.
Chris Grant
@ChrisGrant
Jan 08 2016 12:49

I've got a Typescript Angular project and im trying to consume an external library by importing it's core.js file, which has the following in it

exports.AppComponent = require('./lib/AppComponent').AppComponent;

But I can't seem to get that to work with systemjs. It complains with Uncaught ReferenceError: exports is not defined, which is true, but I thought systemjs was able to consume these files. Obviously it doesn't work this way so does anyone have any pointers in the right direction?

DeanB2015
@DeanB2015
Jan 08 2016 14:42
@ChrisGrant I always use external modules and import declarations when using SystemJS. I thought import require exists for backward compatibility. Would is be easy to remove the require and use import {AppComponent} from "./lib/AppComponent"?
TypeScript import declaration info =
https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#1132-import-declarations
Chris Grant
@ChrisGrant
Jan 08 2016 14:43
@DeanB2015 potentially. I'm in the middle of trying out webpack instead just so I can get a good overview of both ways of developing an angular app. I'll switch branch and try that out that once I've finished the webpack version. Thank you for your help!
DeanB2015
@DeanB2015
Jan 08 2016 15:38
@ghpabs Very cool Angular 2 seed / starter kit. Here's my index.html version for Angular2 beta + TypeScript + Cordova.
https://github.com/dbiele/TypeScript-Cordova-SystemJS-Angular2-beta/blob/master/CODE/www/index.html
Adam Reis
@adamreisnz
Jan 08 2016 21:34
Hi all, is it possible to define a main “app” module for your application so that you can import all app files from that namespace rather than having to work with relative paths (e.g. import something from ‘app/shared/my-module' instead of import something from ‘../../shared/my-module’)? If so, how would you go about configuring systemjs to support this app namespace if you will, and still know to look in other locations (e.g. node_modules) for other modules? Thanks in advance.
Peter Uithoven
@peteruithoven
Jan 08 2016 21:37
@adambuczynski you don't have to use relative paths. You can use absolute paths, probably from the folder you have configured in baseURL, which is probably your project's root folder.