Unexpected value ‘NativeHttpModule’ in Ionic 5

Fix - Unexpected value ‘NativeHttpModule’… Please add a @NgModule annotation.

I came across this one particular issue which stopped me from taking prod build. After hours of search and trial method this is how I resolved it.

First, upgrade your ionic-native-http-connection-backend module to 8.1.1 or above in your package json file.

Second, set ‘enableIvy’ as true in tsconfig json file.

Third and a general practice, update all your pipeable operators to their latest syntax and avoid using the deprecated syntax.

For example :

  1. do -> tap
  2. catch -> catchError
  3. switch -> switchAll
  4. finally -> finalize

Finally, take a production build of your favorite Ionic application using “ionic cap build android -- prod”.

This applies well to other npm modules as well (more or less) . Happy coding!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response