2
votes

I am trying to use the List module from immutable.js on a new Angular 2 project. When I do that, the browser tries to GET http://localhost:3000/immutable and fails with a 404 Not Found error.

Here is what I did:

I then modified app.module.ts as follows:

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);
  }
}

When I npm start the project, I get the 404 error.

Am I missing something obvious?

1

1 Answers

1
votes

After more googling, I found that the answer was pretty easy. I just needed to add a new element to the map in systemjs.config.js:

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