Angular 7 生产构建失败

3

我创建了一个Angular 7工程,将Ng-zorro添加到我的项目中。在使用ng serve进行开发时一切都很正常。我通过以下命令添加了serviceworker:

ng add @angular/pwa

在我的tsconfig文件中,我添加了以下行:
"angularCompilerOptions": {
  "enableIvy": true
} 

在使用ng serve或npm start时,一切正常。但是当我尝试使用ng build --prod时,它会出现以下错误:

ERROR in : Template parse errors:
The pipe 'nzI18n' could not be found ("down-menu-item ant-select-dropdown-menu-item-disabled">
    {{ nzNotFoundContent ? nzNotFoundContent[ERROR ->] : ('Select.notFoundContent' | nzI18n) }}
  </li>
  <li
"): /Volumes/Zotac 120GB/6sense/Projects/ngx-boilerplate/node_modules/ng-zorro-antd/ng-zorro-antd.d.ts.ɵbo.html@11:44
The pipe 'nzFilterOptionPipe' could not be found ("
    [nzMode]="nzMode"
    [compareWith]="compareWith"
    *ngFor="let op[ERROR ->]tion of listOfNzOptionComponent | nzFilterOptionPipe : nzSearchValue : nzFilterOption : nzServerSearc"): /Volumes/Zotac 120GB/6sense/Projects/ngx-boilerplate/node_modules/ng-zorro-antd/ng-zorro-antd.d.ts.ɵbo.html@24:18
The pipe 'nzSubFilterOptionPipe' could not be found ("
  </li>
  <li
    *ngFor="let g[ERROR ->]roup of listOfNzOptionGroupComponent | nzSubFilterOptionPipe : nzSearchValue : nzFilterOption : nzSer"): /Volumes/Zotac 120GB/6sense/Projects/ngx-boilerplate/node_modules/ng-zorro-antd/ng-zorro-antd.d.ts.ɵbo.html@31:17
The pipe 'nzFilterOptionPipe' could not be found ("
        [nzMode]="nzMode"
        [compareWith]="compareWith"
        *ngFor="let op[ERROR ->]tion of group.listOfNzOptionComponent | nzFilterOptionPipe : nzSearchValue : nzFilterOption : nzServe"): /Volumes/Zotac 120GB/6sense/Projects/ngx-boilerplate/node_modules/ng-zorro-antd/ng-zorro-antd.d.ts.ɵbo.html@46:22
The pipe 'nzFilterOptionPipe' could not be found ("
    [nzMode]="nzMode"
    [compareWith]="compareWith"
    *ngFor="let op[ERROR ->]tion of listOfTagOption | nzFilterOptionPipe : nzSearchValue : nzFilterOption : nzServerSearch "
    "): /Volumes/Zotac 120GB/6sense/Projects/ngx-boilerplate/node_modules/ng-zorro-antd/ng-zorro-antd.d.ts.ɵbo.html@59:18

你导入了PipesModule吗? - Sachila Ranawaka
你把 ng-zorro 的主模块引入在哪里?是 app.module 中还是懒加载的模块中?如果是懒加载的模块,可能会出现这个错误。 - Deepak Thomas
1个回答

0

这是一个库版本的问题,请尝试降低您的库版本


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接