javascript - How to include zone.js, reflect-metadata etc. in Systemjs builder task? -
i'm using system.js , systemjs builder create dist
folder packed javascript files of angular2 application.
it works pretty nicely, except not include following files, statically included in index.html:
- node_modules/zone.js/dist/zone.js
- node_modules/reflect-metadata/reflect.js
- node_modules/systemjs/dist/system.src.js
- node_modules/esri-system-js/dist/esrisystem.js
how can force systemjs builder include these dependencies?
libs-bundle.js:
var systembuilder = require('systemjs-builder'); var builder = new systembuilder(); builder.loadconfig('./systemjs.config.js').then(function() { return builder.bundle('app - [app/**/*]', // build app , remove app code - leaves 3rd party dependencies 'dist/libs-bundle.js'); }).then(function() { console.log('library bundles built successfully!'); });
app-bundle.js
var systembuilder = require('systemjs-builder'); var builder = new systembuilder(); builder.loadconfig('./systemjs.config.js').then(function() { return builder.bundle('app - dist/libs-bundle.js', // build app only, exclude included in dependencies 'dist/app-bundle.js'); }).then(function() { console.log('application bundles built successfully!'); });
systemjs.config.js:
/** * system configuration angular 2 samples * adjust necessary application needs. */ (function(global) { system.config({ paths: { // paths serve alias 'npm:': 'node_modules/' }, // map tells system loader things map: { // our app within app folder app: 'dist', // angular bundles '@angular/core': 'npm:@angular/core/bundles/core.umd.js', '@angular/common': 'npm:@angular/common/bundles/common.umd.js', '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', '@angular/http': 'npm:@angular/http/bundles/http.umd.js', '@angular/router': 'npm:@angular/router/bundles/router.umd.js', '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', // other libraries 'rxjs': 'npm:rxjs', 'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api', 'ng2-slim-loading-bar': 'npm:/ng2-slim-loading-bar', 'ng2-toasty': 'npm:/ng2-toasty', 'primeng': 'npm:/primeng', '@angular2-material/core': 'npm:/@angular2-material/core', '@angular2-material/grid-list': 'npm:/@angular2-material/grid-list' }, // packages tells system loader how load when no filename and/or no extension packages: { app: { main: './main.js', defaultextension: 'js' }, rxjs: { defaultextension: 'js' }, 'esri-mods': { defaultextension: 'js' }, 'angular2-in-memory-web-api': { main: './index.js', defaultextension: 'js' }, 'ng2-slim-loading-bar': { main: 'index.js', defaultextension: 'js' }, 'ng2-toasty': { main: 'index.js', defaultextension: 'js' }, 'primeng': { defaultextension: 'js' }, '@angular2-material/core': { main: './core.umd.js', defaultextension: 'js' }, '@angular2-material/grid-list': { main: './grid-list.umd.js', defaultextension: 'js' } }, meta: { 'esri/*': { build: false }, 'esri-mods': { build: false }, 'dojo/*': { build: false }, } }); })(this);
Comments
Post a Comment