(SystemJS) XHR error @angular/commobundles/common.umd.js/http not found

前端 未结 2 1292
醉酒成梦
醉酒成梦 2021-01-18 23:39

I am making a simple http request in my application.

I am using Angular 2 Quickstart and updating all my angular packages to 4.3.4

This is my package.

相关标签:
2条回答
  • 2021-01-19 00:32

    I suspect you should add the following keys to your systemjs configuration:

     map: {
      ...
      '@angular/common/http': 'npm:@angular/common/bundles/common-http.umd.js',
      'tslib': 'npm:tslib/tslib.js'
    

    Plunker Example

    tslib is required because @angular/common/http depends on it. https://github.com/angular/common-builds/blob/4.3.0/bundles/common-http.umd.js#L7

    0 讨论(0)
  • 2021-01-19 00:34

    You should add map in systemjs configuration @angular/common/http

    '@angular/common/http': 'node_modules/@angular/common/bundles/common-http.umd.js'
    

    Additionally It requires tslib

    'tslib': 'npm:tslib/tslib.js'
    
    0 讨论(0)
提交回复
热议问题