NG-ZORRO / ng-zorro-antd

Angular UI Component Library based on Ant Design
https://ng.ant.design
MIT License
8.87k stars 3.94k forks source link

CommonJS or AMD dependencies can cause optimization bailouts #6098

Closed dylanvdmerwe closed 3 years ago

dylanvdmerwe commented 3 years ago

Steps to reproduce

When doing a --prod build the following warning is presented: .

WARNING in C:\Projects\Kasi\WebsiteProjects\Website.Portal\kasi-portal\node_modules\@ant-design\icons-angular\__ivy_ngcc__\fesm2015\ant-design-icons-angular.js depends on '@ant-design/colors'. CommonJS or AMD dependencies can cause optimization bailouts.

What is actually happening?

Shows a warning when it doesn't need to.

Environment Info
ng-zorro-antd 10.1.2
Browser Chrome
Angular 10.1.4
C3maLi commented 3 years ago

I produced a solution like this. Try it if you wish.

angular.json "architect": { "build": { "options": { "allowedCommonJsDependencies": [ "@ant-design/colors" ] }, } }

wzhudev commented 3 years ago

Could you please check the version of the '@ant-design/colors' in your node_modules? We have fixed the problem in lastest version (5.0.0).

dylanvdmerwe commented 3 years ago

package.json in @ant-design/colors in node_modules says "version": "4.0.5". We are running ng-zorro-antd 10.1.1.

wzhudev commented 3 years ago

Try to update '@ant-design/icons-angular' to 10.2.0 or higher. It would depend on @ant-design/color@5.0.0.

dylanvdmerwe commented 3 years ago

We have no dependency on this. In our packages we only have: "ng-zorro-antd": "^10.1.1".

wzhudev commented 3 years ago

We have no dependency on this. In our packages we only have: "ng-zorro-antd": "^10.1.1".

The dependency graph is: 'ng-zorro-antd' > '@ant-design/icons-angular' > '@ant-design/colors'.

Reinstalling ng-zorro-antd should also fix this if you don't have the version numbers locked.

dylanvdmerwe commented 3 years ago

Removed ng-zorro-antd. Readded it (10.1.2) and it looks like the warning has now gone away. Strange these packages were not updated.

wzhudev commented 3 years ago

I am closing this issue since this could be fixed by reinstalling. 😄