smmorneau / tour-of-heroes

Angular 2 Starter Project in Typescript with Linting, Minifying, and Bundling
https://tour-of-heroes-typescript.herokuapp.com/
40 stars 27 forks source link

production setup #4

Open inska opened 8 years ago

inska commented 8 years ago

Hi,

I am working on setup angular 2 project to run on production with systemjs and gulp..

How can I include 3rd party libraries which that installed via NPM on system.config.js?

currently I am using angular-cli and system.config.js file composed like as below: const map: any = { '@angular2-material': 'vendor/@angular2-material' ... }

Thanks, Inska

smmorneau commented 8 years ago

@inska I haven't used the angular-cli yet, but this is how I included third-party libraries like moment and lodash:

var map = {
  ...
  'lodash':                             'lib/js/lodash',
  'moment':                             'lib/js/moment'
};

var packages = {
  ...
  'moment':                             { main: 'moment', defaultExtension: 'js' },
  'lodash':                             { main: 'index', defaultExtension: 'js' }
};

System.config({
  map: map,
  packages: packages
});
inska commented 8 years ago

@smmorneau,

Then, loadash.js should be exist in lib/js/lodash? as sole file? I understood all external libraries were minified and merged into vendors.min.js..