Steps for adding third party library that worked for me in angular-cli
download the d3 typing from typing and paste it in main and browser folder with in typing folder.
Add reference in corresponding index.ts files.
Add the map in the system.config (My system.config file).
<script>
System.config({
map:{
'@angular2-material' : 'vendor/@angular2-material',
"d3" : "vendor/d3/d3.js",
"lodash" : "vendor/lodash/lodash.js",
"@angular/platform-browser": "vendor/@angular/platform-browser",
'@angular/core/src/facade': 'vendor/@angular/core/src/facade',
//'@angular/platform-browser-dynamic': 'vendor/@angular/platform-browser-dynamic/platform-browser-dynamic.umd.js',
'angular2-modal': 'vendor/angular2-modal',
'angular2-modal/platform-browser': 'vendor/angular2-modal/platform-browser'
},
packages:{
'@angular2-material':{
map:{
'./button':'./button/button.js',
'./card':'./card/card.js',
'./checkbox':'./checkbox/checkbox.js',
'./input':'./input/input.js',
'./progress-circle':'./progress-circle/progress-circle.js',
'./sidenav':'./sidenav/sidenav.js',
'./toolbar':'./toolbar/toolbar.js',
'./icon':'./icon/icon.js'
}
},
"d3": {
"defaultExtension": "js"
},
"lodash": {
"defaultExtension": "js"
},
'@angular2-material/core': {
defaultExtension: 'js',
format: 'cjs',
main: 'core'
},
'@angular2-material/checkbox': {
defaultExtension: 'js',
format: 'cjs',
main: 'checkbox'
},
'@angular2-material/button': {
defaultExtension: 'js',
format: 'cjs',
main: 'button'
},
'@angular2-material/icon': {
defaultExtension: 'js',
format: 'cjs',
main: 'icon'
},
'@angular2-material/sidenav': {
defaultExtension: 'js',
format: 'cjs',
main: 'sidenav'
},
'vendor/angular2-modal': {main: 'index.js', defaultExtension: 'js'},
'vendor/angular2-modal/platform-browser': {main: 'index.js', defaultExtension: 'js'},
'vendor/angular2-modal/plugins/bootstrap': {main: 'index.js', defaultExtension: 'js'},
'vendor/angular2-modal/plugins/vex': {main: 'index.js', defaultExtension: 'js'},
'vendor/angular2-modal/plugins/js-native': {main: 'index.js', defaultExtension: 'js'},
'@angular/core/src/facade': {defaultExtension: 'js'}
}
});
System.import('system-config.js').then(function () {
System.import('main');
}).catch(console.error.bind(console));
</script>
import it in the corresponding components
import * as d3 from 'd3';
following the same steps worked for lodash well. Thanks