无法为ASP.NET Boilerplate构建Angular项目的prod版本

时间:2018-01-08 14:02:43

标签: aspnetboilerplate

我正在尝试构建ABP 3.4.1的prod版本但是当我运行yarn run ng build --prod时,我得到以下异常:

11% building modules 11/14 modules 3 active 
...\bootstrap\dist\css\bootstrap.min.cssNode#moveTo was deprecated. Use 
Container#append.                     Date: 2018-01-08T13:43:30.326Z
Hash: 988f3df7ec204a6033a2
Time: 21028ms
chunk {0} styles.e1f5a87bb585ebbb225d.bundle.css (styles) 414 kB [initial]
[rendered]   
chunk {1} polyfills.3bc34265385d52184eab.bundle.js (polyfills) 86 bytes 
[initial] [rendered]
chunk {2} main.e402deade8b026b7d50e.bundle.js (main) 84 bytes [initial] 
[rendered]
chunk {3} inline.a6814d03da59c81640d4.bundle.js (inline) 1.45 kB [entry] 
[rendered]

ERROR in : "let-" is only supported on ng-template elements. ("
  </thead>
  <tbody>
    <template ngFor [ngForOf]="rows" [ERROR ->]let-rowz="$implicit" let-index="index">
    <tr *ngIf="!(datePicker.onlyCurrentMonth && rowz[0].sec")
: "let-" is only supported on ng-template elements. ("
  </thead>
  <tbody>
    <template ngFor [ngForOf]="rows" let-rowz="$implicit" [ERROR ->]let-index="index">
      <tr *ngIf="!(datePicker.onlyCurrentMonth && rowz[0].secondary && rowz[6].sec")

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

我无法弄清楚这个错误发生在哪里但是在搜索之后我发现this post建议我设置--aot=false,但后来我收到以下错误:

11% building modules 13/19 modules 6 active 
...\bootstrap\dist\css\bootstrap.min.cssNode#moveTo was deprecated. Use 
Container#append.                      94% asset optimization(node:2080) 
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token: punc ({)
(node:2080) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 60.77s.

如何正确构建prod版本?

1 个答案:

答案 0 :(得分:1)

在此问题中回答:https://github.com/valor-software/ngx-bootstrap/issues/3024

  

使用ngx-bootstrap@2.0.0-beta.8

angular / package.json 中设置:

"ngx-bootstrap": "^2.0.0-beta.8",