Search code examples
typescriptangularangular2-routingangular2-router

Error 404: Cannot found @angular/router/bundles/router.umd.js


I am setting up routing in Angular 2, and everything is the same based on the documentation from their website.

Here is an example of my import in my app.component.ts

import {Component} from '@angular/core';
import {ROUTER_DIRECTIVES} from '@angular/router';

@Component({
  selector: 'my-app',
  templateUrl: 'app/templates/html/app.component.html',
  directives: [ROUTER_DIRECTIVES]
})

export class AppComponent{

}

Unfortunately I am getting this error.

enter image description here

I look at my file tree, and I noticed that there is no bundles folder inside @angular/router

enter image description here

Is this a bug? How can I fix this? Thanks!


Solution

  • The router package doesn't have a bundle at the moment.

    So check your systemjs config. I quess you forgot the following line:

    // No umd for router yet
    packages['@angular/router'] = { main: 'index.js', defaultExtension: 'js' };
    

    See also https://github.com/alexzuza/angular2-typescript-systemjs/blob/master/systemjs.config.js#L40