Angular9或10及以后的版本,如果自定义的类上面没有写装饰器的话,编译后在Browser平台不会报错,但是在执行打包命令npm run build --prod时就会报错如下所示:
error NG2007: Class is using Angular features but is not decorated. Please add an explicit Angular decorator.
@Directive()
export class BaseEntity {
}
// 或
@Component({selector: 'aaaa', template:''})
export class BaseEntity {
}