Angular:ng prod构建错误

时间:2018-03-14 12:04:23

标签: angular

我正在使用Angular 5.当我对项目(ng build --prod)进行prod构建时,它会失败并显示错误:

ERROR in @angular\http\http.ts(18,2): Error during template compile of 'BrowserXhr'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'Injectable'
    'Injectable' calls 'ɵmakeDecorator'.

我的角度版本如下:

   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.7.3
Node: 8.9.0
OS: win32 x64
Angular: 5.1.1
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

@angular/cli: 1.7.3
@angular/language-service: 4.4.6
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.4.2
webpack: 3.11.0

有没有人暗示这可能是什么?

1 个答案:

答案 0 :(得分:0)

对于以后遇到相同问题的任何人: 我设法通过将构建配置中angular.json(可能是angular-cli.json)中的“ aot”和“ buildOptimizer”设置为false来解决此问题。