Ng-zorro-antd: Unable to build in Production

Created on 13 Apr 2019  ·  6Comments  ·  Source: NG-ZORRO/ng-zorro-antd

Reproduction link

https://stackblitz.com/edit/ng-zorro-antd-start?sadas

Steps to reproduce

  1. Create a NgModule
  2. Add to that module the "NzMenuModule".
  3. Build in production

What is expected?

Should not stop the compilation and should not use typings to resolve the class, but a real .ts files.

What is actually happening?

Unexpected value 'NzMenuModule in node_modules/ng-zorro-antd/ng-zorro-antd.d.ts' imported by the module 'ServicesModule in src/app/core/services/services.module.ts'. Please add a @NgModule annotation.

| Environment | Info |
|---|---|
| ng-zorro-antd | 7.1.0 |
| Browser | NOT RELATED |


Not possible to build on Stacklitz in Production mode.

Bug Menu 🖨 Build

Most helpful comment

7.4.0 reintroduces this problem @wendzhue , happened to me with NzButtonModule, with a shared module that imports and exports the NzButtonModule (among others).

ERROR in : Unexpected value 'NzButtonModule in C:/pf/node_modules/ng-zorro-antd/ng-zorro-antd.d.ts' imported by the module 'SharedModule in C:/pf/apps/pf/src/app/shared/shared.module.ts'. Please add a @NgModule annotation.

All 6 comments

https://ng.ant.design/docs/faq/en#why-individually-importing-is-not-supported

we do not support secondary module import now, plz follow https://github.com/NG-ZORRO/ng-zorro-antd/pull/3234

Duplicate of #700.

7.4.0 reintroduces this problem @wendzhue , happened to me with NzButtonModule, with a shared module that imports and exports the NzButtonModule (among others).

ERROR in : Unexpected value 'NzButtonModule in C:/pf/node_modules/ng-zorro-antd/ng-zorro-antd.d.ts' imported by the module 'SharedModule in C:/pf/apps/pf/src/app/shared/shared.module.ts'. Please add a @NgModule annotation.

@fabioemoutinho we will fix it today, thanks for your report

@fabioemoutinho ng-zorro-antd.metadata.json is messed up because a bug of ng-packagr: https://github.com/ng-packagr/ng-packagr/issues/594. We are fixing this. Thank you for your report.

Was this page helpful?
0 / 5 - 0 ratings