diff --git a/public/docs/_examples/systemjs.config.plunker.js b/public/docs/_examples/systemjs.config.plunker.js index 8662c998b3..203bd273ed 100644 --- a/public/docs/_examples/systemjs.config.plunker.js +++ b/public/docs/_examples/systemjs.config.plunker.js @@ -2,7 +2,6 @@ * PLUNKER VERSION (based on systemjs.config.js in angular.io) * System configuration for Angular 2 samples * Adjust as necessary for your application needs. - * Override at the last minute with global.filterSystemConfig (as plunkers do) */ (function(global) { @@ -10,10 +9,14 @@ //map tells the System loader where to look for things var map = { - 'app': 'app', // 'dist', + '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/rxjs@5.0.0-beta.6', - 'angular2-in-memory-web-api': 'https://npmcdn.com/angular2-in-memory-web-api' // get latest - }; + 'ts': 'https://npmcdn.com/plugin-typescript@4.0.10/lib/plugin.js', + 'typescript': 'https://npmcdn.com/typescript@1.8.10/lib/typescript.js', + }; //packages tells the System loader how to load when no filename and/or no extension var packages = { @@ -22,40 +25,45 @@ 'angular2-in-memory-web-api': { defaultExtension: 'js' }, }; - var packageNames = [ - '@angular/common', - '@angular/compiler', - '@angular/core', - '@angular/http', - '@angular/platform-browser', - '@angular/platform-browser-dynamic', - '@angular/router', - '@angular/router-deprecated', - '@angular/upgrade', + var ngPackageNames = [ + 'common', + 'compiler', + 'core', + 'http', + 'platform-browser', + 'platform-browser-dynamic', + 'router', + 'router-deprecated', + 'upgrade', ]; - // add map entries for angular packages in the form '@angular/common': 'https://npmcdn.com/@angular/common@0.0.0-3?main=browser' - packageNames.forEach(function(pkgName) { - map[pkgName] = 'https://npmcdn.com/' + pkgName + ngVer; + // 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 in the form '@angular/common': { main: 'index.js', defaultExtension: 'js' } - packageNames.forEach(function(pkgName) { - packages[pkgName] = { main: 'index.js', defaultExtension: 'js' }; + // 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: 'typescript', typescriptOptions: { emitDecoratorMetadata: true }, + map: map, packages: packages } - // filterSystemConfig - index.html's chance to modify config before we register it. - if (global.filterSystemConfig) { global.filterSystemConfig(config); } - System.config(config); })(this); diff --git a/tools/plunker-builder/indexHtmlTranslator.js b/tools/plunker-builder/indexHtmlTranslator.js index 912bd50aaf..05be3a90f2 100644 --- a/tools/plunker-builder/indexHtmlTranslator.js +++ b/tools/plunker-builder/indexHtmlTranslator.js @@ -18,17 +18,7 @@ var _rxRules = { link: { from: '//', to: '' - }, - config: { - from: /\s*System.config\(\{[\s\S]*\}\);/m, - to: "\n" + - " System.config({\n" + - " transpiler: 'typescript', \n" + - " typescriptOptions: { emitDecoratorMetadata: true }, \n" + - " packages: {'app': {defaultExtension: 'ts'}} \n" + - " });" - }, - + } }; var _rxData = [ @@ -38,7 +28,7 @@ var _rxData = [ { pattern: 'script', from: 'node_modules/es6-shim/es6-shim.min.js', - to: 'https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.0/es6-shim.min.js' + to: 'https://npmcdn.com/es6-shim@0.35.0/es6-shim.min.js' }, { pattern: 'script', @@ -58,7 +48,7 @@ var _rxData = [ { pattern: 'script', from: 'node_modules/systemjs/dist/system.src.js', - to: ['https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.27/system.js', 'https://npmcdn.com/typescript@1.8.10/lib/typescript.js'] + to: 'https://npmcdn.com/systemjs@0.19.27/dist/system.src.js' }, { pattern: 'script', @@ -72,9 +62,6 @@ var _rxData = [ }, { pattern: 'angular_pkg', - }, - { - pattern: 'config', } ];