Skip to content

Instantly share code, notes, and snippets.

@Osein
Created May 20, 2016 08:15
Show Gist options
  • Save Osein/132353ad85b9fa76fc3bf56bc6931c0e to your computer and use it in GitHub Desktop.
Save Osein/132353ad85b9fa76fc3bf56bc6931c0e to your computer and use it in GitHub Desktop.

Revisions

  1. Osein created this gist May 20, 2016.
    80 changes: 80 additions & 0 deletions systemjs.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,80 @@
    /**
    * PLUNKER VERSION (based on systemjs.config.js in angular.io)
    * System configuration for Angular 2 samples
    * Adjust as necessary for your application needs.
    */
    (function(global) {

    var ngVer = '@2.0.0-rc.1'; // lock in the angular package version; do not let it float to current!

    //map tells the System loader where to look for things
    var map = {
    'app': 'app',

    '@angular': 'https://npmcdn.com/@angular', // sufficient if we didn't pin the version
    'angular2-in-memory-web-api': 'https://npmcdn.com/angular2-in-memory-web-api', // get latest
    'rxjs': 'https://npmcdn.com/[email protected]',
    'ts': 'https://npmcdn.com/[email protected]/lib/plugin.js',
    'typescript': 'https://npmcdn.com/[email protected]/lib/typescript.js',
    };

    //packages tells the System loader how to load when no filename and/or no extension
    var packages = {
    'app': { main: 'main.ts', defaultExtension: 'ts' },
    'rxjs': { defaultExtension: 'js' },
    'angular2-in-memory-web-api': { defaultExtension: 'js' },
    };

    var ngPackageNames = [
    'common',
    'compiler',
    'core',
    'http',
    'platform-browser',
    'platform-browser-dynamic',
    'router',
    'router-deprecated',
    'upgrade',
    ];

    // Add map entries for each angular package
    // only because we're pinning the version with `ngVer`.
    ngPackageNames.forEach(function(pkgName) {
    map['@angular/'+pkgName] = 'https://npmcdn.com/@angular/' + pkgName + ngVer;
    });

    // Add package entries for angular packages
    ngPackageNames.forEach(function(pkgName) {

    // Bundled (~40 requests):
    packages['@angular/'+pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' };

    // Individual files (~300 requests):
    //packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
    });

    var config = {
    // DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
    transpiler: 'ts',
    typescriptOptions: {
    tsconfig: true
    },
    meta: {
    'typescript': {
    "exports": "ts"
    }
    },
    map: map,
    packages: packages
    }

    System.config(config);

    })(this);


    /*
    Copyright 2016 Google Inc. All Rights Reserved.
    Use of this source code is governed by an MIT-style license that
    can be found in the LICENSE file at http://angular.io/license
    */