Skip to content

Remove @angular/http from the dependecies #1842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
VladimirAmiorkov opened this issue May 31, 2019 · 8 comments
Closed

Remove @angular/http from the dependecies #1842

VladimirAmiorkov opened this issue May 31, 2019 · 8 comments

Comments

@VladimirAmiorkov
Copy link
Contributor

Environment

  • NativeScript-Angular: 8.0.0
  • Angular: 8.0.0

Describe the bug
The current 8.0.0 version of the plugin has a dependency for the @angular/http which is deprecated and replaced by the @angular/common/http package.

@charsleysa
Copy link

The entire NSHttp module should be removed since Angular 8 no longer even has an Http module (only HttpClient).

IMO [email protected] should be unpublished and 8.0.3 published with this code removed as it should have never been released with an unsupported beta library as a dependency.

@VladimirAmiorkov
Copy link
Contributor Author

Hi @charsleysa ,

Have you experienced any issues related to the use of the @angular/http in the [email protected] ? In all of our tests the latest "@angular/http": "8.0.0-beta.10" version is working correctly no matter that it is a beta version.

We are planning to remove this as soon as possible but if you feel like contributing to the project we welcome your PR and contribution. Thank you.

@charsleysa
Copy link

Hi @VladimirAmiorkov

We are seeing compilation errors wherever we include the nativescript-angular library at the root (so import { ... } from 'nativescript-angular'.

ERROR in nativescript-angular/http/http.module.ts(19,20): Error during template compile of 'NativeScriptHttpModule'
  Could not resolve @angular/http relative to [object Object]..
node_modules/nativescript-angular/http/ns-http.d.ts(1,96): error TS2307: Cannot find module '@angular/http'.

This seems to be due to the NSHttp module being reference by the root index.ts file.

I would be happy to contribute a PR, though this is more of a release issue as this code should have been removed before [email protected] was published so removing it now would be deemed a breaking change triggering a major version bump (as per semver).

My proposed solution effectively rolls in the breaking change into the 8.0 release by unpublishing all prior 8.0.x releases and updating the changelog to note why.

Thoughts?

@VladimirAmiorkov
Copy link
Contributor Author

Does your project have a dependency of @angular/http ? Unpublishing a version of nativescript-angular is not an option because we do not see any issues of using the latest version of @angular/http which was released specifically for Angular 8 during its beta. The reason for not removing it before our 8.0.0 release was that there was no mentioning from the Angular team that this package will not leave the beta stage and that decision was made behind closed doors and we were only made aware at the release day of Angular 8.0.0 at which point it was too late to remove it since we are committed to delivering day one support for major releases of Angular.

I am asking you if you find any real issues with having @angular/http as a dependency in you project because in all of our tests there is not issues either at runtime and at compilation time of the {N} + Angular project that uses it.

@charsleysa
Copy link

Hi @VladimirAmiorkov

I can confirm that adding @angular/[email protected] to the dependencies allows the compilation to succeed and the app runs without any apparent issues. One thing to note is that the library seems to be included in the vendor bundle, which is less than desirable, but I think its impact on bundle size during a production build mostly reduced thanks to the angular/webpack optimizers.

Thanks for the help.

@VladimirAmiorkov
Copy link
Contributor Author

Yes that is correct, webpack will tree share that dep from the bundle and it will not affect the size of the app. Also in NativeScript 6.0.0 webpack is executed in all builds by default so the tree sharking is also present for local development.

You are welcome. We are in the process of addressing this and migrating from this deprecated package or deprecating it so we can remove it safely in future version.

@charsleysa
Copy link

@VladimirAmiorkov this can be closed now as it was solved by #1942

@VladimirAmiorkov
Copy link
Contributor Author

Resolved via #1942

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants