无法将列表模块从imputable.js导入到Angular 2项目中



我正在尝试在新的Angular 2项目上使用Immutable.js的List模块。当我这样做时,浏览器尝试获取http://localhost:3000/不变,未找到404的失败。

这是我所做的:

  • 我克隆了Angular 2 Quickstartgithub的回购(https://github.com/angular/quickstart)
  • 我运行npm installnpm install -D immutable

i然后修改app.module.ts如下:

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent }  from './app.component';
import { List } from 'immutable';
@NgModule({
  imports:      [ BrowserModule ],
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { 
  constructor() {
    let list = List.of(1,2,3);
  }
}

当我 npm start项目时,我会收到404错误。

我缺少明显的东西吗?

在更多谷歌搜索后,我发现答案很容易。我只需要在systemjs.config.js中的地图上添加一个新元素:

// other libraries
[...]
'immutable': 'node_modules/immutable/dist/immutable.js'

最新更新