Components: @angular/http not marked as peer dependency

Created on 17 Jul 2017  路  8Comments  路  Source: angular/components

Bug, feature request, or proposal:

Bug

What is the current behavior?

If @angular/http is installed but HttpModule not loaded in AppModule, compilation is OK and icons work well (the font is loaded locally so no server requests are needed).

But if @angular/http is uninstalled, Angular CLI compilation fails (and so I can't even run my app) :

ERROR in/node_modules/@angular/material/typings/icon/icon-registry.d.ts (10,22): Cannot find module '@angular/http'.

ERROR in ./~/@angular/material/@angular/material.es5.js
Module not found: Error: Can't resolve '@angular/http' in '/node_modules/@angular/material/@angular'
 @ ./~/@angular/material/@angular/material.es5.js 20:0-37
 @ ./src/app/core/core.module.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

What is the use-case or motivation for changing an existing behavior?

Angular 4.3 introduced new HttpClient API, meaning we may not need anymore the previous Http API. And in this case, we should be able to not install @angular/http in the project, to have smaller bundles sizes.

What is the expected behavior?

Material icons seems to do hard imports of @angular/http even if it doesn't need them. They should be remove when not necessary.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

@angular/cli 1.2.1
@angular/core 4.3.0
@angular/material beta.8

P3

Most helpful comment

Any clue on this issue? We are running on the same problem 28 days later. Thanks guys!

PS: this is blocking issue given we cannot compile anymore. We had to install @angular/http and now have a larger bundle :/

All 8 comments

The real issue here is that @angular/http should be a peerDependency of Angular Material; the library needs to import symbols from @angular/http to even compile.

We are likely going to switch to the new http client eventually (@angular/common/http), so this will likely be resolved then.

Any clue on this issue? We are running on the same problem 28 days later. Thanks guys!

PS: this is blocking issue given we cannot compile anymore. We had to install @angular/http and now have a larger bundle :/

I believe that material now uses common/http so this issue is now obsolete and could be closed.

Not yet, the PR is not merged. Mine is closed because it was ignored and the same work has been redone in another PR by a team member...

Please correct this bug

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jelbourn picture jelbourn  路  3Comments

michaelb-01 picture michaelb-01  路  3Comments

alanpurple picture alanpurple  路  3Comments

julianobrasil picture julianobrasil  路  3Comments

LoganDupont picture LoganDupont  路  3Comments