Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"ERROR in getInternalNameOfClass() called on a non-ES5 class: expected AngularFireModule to have an inner class declaration"

Terminal -      "WARNING in Invalid constructor parameter decorator in D:/New folder/SilverLife/node_modules/@angular/fire/fesm2015/angular-fire.js:      () => [         { type: Object, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }     ]          ERROR in getInternalNameOfClass() called on a non-ES5 class: expected     AngularFireModule to have an inner class declaration" 

I am facing this issue while integrating Angular firebase in my Angular 9 project. My application's package.json

like image 522
D_B Avatar asked Jul 04 '20 18:07

D_B


2 Answers

Try changing target in the compilerOptions of your tsconfig.json from es5 to es2015

like image 176
Hubert Formin Avatar answered Sep 19 '22 15:09

Hubert Formin


I encountered same issue during migration from Angular8 to Angular9.

In Angular9 they introduced new generation compilation and rendering pipeline called Angular Ivy. The documentation says:

Ivy applications can be built with libraries that were created with the View Engine compiler. This compatibility is provided by a tool known as the Angular compatibility compiler (ngcc). CLI commands run ngcc as needed when performing an Angular build.

Source: https://angular.io/guide/ivy

So in order to project with "target": "es5" work, after using npm install you have to run ngcc.

You can add it in your package.json file:

{   "scripts": {     "postinstall": "ngcc"   } } 

Then it should run automaticly after running npm install.

like image 38
iLoveUnicorns Avatar answered Sep 20 '22 15:09

iLoveUnicorns