我正在尝试使用-aot选项(ng build -aot)构建应用程序.我有以下错误:
ERROR in Error during template compile of 'MyComponent' Function calls are not supported in decorators but 'classLogger' was called in 'cLog' 'cLog' calls 'classLogger'.
export function classLogger(_classOptions?) { const myLogger = new MyLogger(); myLogger.options = Object.assign({},defaultClassOptions,_classOptions); return myLogger.loggerCB; } // export function clog(options = defaultClassOptions): Function { export function cLog(options?): Function { return loggingEnabled ? classLogger(options) : emptyClassDecorator(); }
附:类装饰器接受必须转移到装饰器补丁回调的选项.
我也遇到过这个问题.在我的情况下,我想覆盖BusyConfig参数.应用程序适用于ng服务,但是当我想为生产构建应用程序时,修饰符不支持函数调用但是…发生异常.
原文链接:https://www.f2er.com/angularjs/141773.html我的解决方案如下:
ng build –prod –aot = false
The Angular Ahead-of-Time (AOT) compiler converts your Angular HTML
and TypeScript code into efficient JavaScript code during the build
phase before the browser downloads and runs that code.
ng build –prod与ng build –prod –aot相同