These are chat archives for systemjs/systemjs

27th
Aug 2016
Josh Tate
@tatems
Aug 27 2016 14:56

Hi, I'm having some trouble with my configuration on an Angular2 app.
This is my system.config.js:

(function (global) {
    // map tells the System loader where to look for things
    var map            = {
        'app'      : 'app', // 'dist',
        '@angular' : 'node_modules/@angular',
        'rxjs'     : 'node_modules/rxjs',
        '@models'  : 'app/models',
        '@services': 'app/services',
        '@model_services': 'app/services/model_services',
        'moment'   : 'node_modules/moment/moment.js',
        'ng2-bootstrap': 'node_modules/ng2-bootstrap'
    };
    // packages tells the System loader how to load when no filename and/or no extension
    var packages       = {
        'app' : {main: 'main.js', defaultExtension: 'js'},
        'rxjs': {defaultExtension: 'js'},
        '@models': {main: 'index'},
        '@services': {main: 'index'},
        '@model_services': {main: 'index'}
    };
    var ngPackageNames = [
        'common',
        'compiler',
        'core',
        'http',
        'platform-browser',
        'platform-browser-dynamic',
        'router',
        'router-deprecated'
    ];
    // Individual files (~300 requests):
    function packIndex(pkgName) {
        packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
    }
    // Bundled (~40 requests):
    function packUmd(pkgName) {
        packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
    }
    // Most environments should use UMD; some (Karma) need the individual index files
    var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
    // Add package entries for angular packages
    ngPackageNames.forEach(setPackageConfig);
    var config = {
        defaultJSExtensions: true,
        map: map,
        packages: packages
    };
    System.config(config);
})(this);

My main.ts lives in src/app/main.ts, however I'm getting a 404 for that file