"ERROR in getInternalNameOfClass() called on a non-ES5 class: expected AngularFireModule to have an inner class declaration"
"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"
我在 Angular 9 项目中集成 Angular firebase 时遇到了这个问题。
尝试将 tsconfig.json
的 compilerOptions
中的目标从 es5
更改为 es2015
我在从 Angular8 迁移到 Angular9 的过程中遇到了同样的问题。
在 Angular9 中,他们引入了称为 Angular Ivy 的新一代编译和渲染管道。文档说:
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.
来源:https://angular.io/guide/ivy
因此,为了使用 "target": "es5"
进行项目,在使用 npm install
之后,您必须 运行 ngcc。
您可以将其添加到您的 package.json 文件中:
{
"scripts": {
"postinstall": "ngcc"
}
}
那么它应该在运行宁npm install
之后自动运行。
我不得不在 tsconfig.json 中使用以下内容:
"angularCompilerOptions": {
"enableIvy": false,
}
不理想,但有效。
添加
"scripts": {
"postinstall": "ngcc"
}
到 package.json 并在 tsconfig.json 中将 target
更改为 es2015
不起作用 - 可能是其他一些设置弄乱了它们。
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"
我在 Angular 9 项目中集成 Angular firebase 时遇到了这个问题。
尝试将 tsconfig.json
的 compilerOptions
中的目标从 es5
更改为 es2015
我在从 Angular8 迁移到 Angular9 的过程中遇到了同样的问题。
在 Angular9 中,他们引入了称为 Angular Ivy 的新一代编译和渲染管道。文档说:
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.
来源:https://angular.io/guide/ivy
因此,为了使用 "target": "es5"
进行项目,在使用 npm install
之后,您必须 运行 ngcc。
您可以将其添加到您的 package.json 文件中:
{
"scripts": {
"postinstall": "ngcc"
}
}
那么它应该在运行宁npm install
之后自动运行。
我不得不在 tsconfig.json 中使用以下内容:
"angularCompilerOptions": {
"enableIvy": false,
}
不理想,但有效。
添加
"scripts": {
"postinstall": "ngcc"
}
到 package.json 并在 tsconfig.json 中将 target
更改为 es2015
不起作用 - 可能是其他一些设置弄乱了它们。