Typescript 如何更新systemjs以查找路径?

Typescript 如何更新systemjs以查找路径?,typescript,angular,angular-local-storage,Typescript,Angular,Angular Local Storage,根据此问题:要将localstorage与angular cli结合使用,我需要更新systemjs以查找路径: node_modules/angular2 localstorage/dist/LocalStorageEmitter.js node_modules/angular2 localstorage/dist/WebStorage.js 我试过这样做,但没有成功 System.config({ paths: { "LocalStorageEmitter": './node_

根据此问题:要将localstorage与angular cli结合使用,我需要更新systemjs以查找路径:

  • node_modules/angular2 localstorage/dist/LocalStorageEmitter.js
  • node_modules/angular2 localstorage/dist/WebStorage.js
我试过这样做,但没有成功

System.config({
  paths: {
   "LocalStorageEmitter": './node_modules/angular2-localstorage/dist/LocalStorageEmitter.js',
   "WebStorage": './node_modules/angular2-localstorage/dist/WebStorage.js'
 }
});

如何以正确的方式做这件事?

我认为你可以按照以下方式做:

System.config({

map: {
"LocalStorageEmitter" : "node_modules/angular2-localstorage/dist",
"WebStorage": "node_modules/angular2-localstorage/dist"
},

packages: {
"LocalStorageEmitter": {main : "LocalStorageEmitter.js", defaultExtension: "js" },
"WebStorage": {main: "WebStorage.js", defaultExtension: "js"
}

});
现在你可以做了

import {__PACKAGE_NAME__} from 'LocalStorageEmitter';
import {__PACKAGE_NAME__} from 'WebStorage';
在其中一个typescript文件中