将外部库存包含在Angular-CLI中的正确方法

时间:2016-07-01 18:02:25

标签: angular angular-cli

我正在尝试在我的Angular-CLI应用中使用Angular2-localstorage

我按照指南这里: Guide to include external libs

但我一直收到这个错误:

  

zone.js:101 GET   http://localhost:4200/node_modules/angular2-localstorage/LocalStorageEmitter.js   404(未找到)

这是我的system-config.ts文件(重要部分):

const map: any = {
  'angular2-localstorage': 'node_modules/angular2-localstorage'
};

/** User packages configuration. */
const packages: any = {
  'angular2-localstorage': {
    defaultExtension: 'js'
  }
};

和angular-cli-build.js:

var Angular2App = require('angular-cli/lib/broccoli/angular2-app');

module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
      'systemjs/dist/system-polyfills.js',
      'systemjs/dist/system.src.js',
      'zone.js/dist/**/*.+(js|js.map)',
      'es6-shim/es6-shim.js',
      'reflect-metadata/**/*.+(ts|js|js.map)',
      'rxjs/**/*.+(js|js.map)',
      '@angular/**/*.+(js|js.map)',
      'angular2-localstorage/LocalStorageEmitter.ts'
    ]
  });
};

0 个答案:

没有答案