Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It doesn't support angular ivy mode #4236

Closed
justwalk opened this issue Sep 27, 2019 · 34 comments
Closed

It doesn't support angular ivy mode #4236

justwalk opened this issue Sep 27, 2019 · 34 comments
Assignees
Milestone

Comments

@justwalk
Copy link

What problem does this feature solve?

it can use angular ivy mode to improve application performance.

What does the proposed API look like?

Ng-zorro cannot compile through ivy mode because date-fns does not support Angular Package Format。

@wzhudev
Copy link
Member

wzhudev commented Sep 27, 2019

@wenqi73 Would you please take a look at this? Be aware of potentional breaking changes.

@lppedd
Copy link
Contributor

lppedd commented Sep 29, 2019

@wendzhue this is the same problem I had seen weeks ago when the beta started.
The date-fns problem is resolved since (if I recall correctly) beta-4.
However it would still be impossible to compile with Ivy, given you have extending components (lets call them "mixins").

Anyway, @justwalk there is settings file named ngcc.config.js for this kinda problems.

@Svetomechc
Copy link
Contributor

@justwalk #3514 (comment) blocking issues in Angular sadly for Ivy support to happen now

@Svetomechc
Copy link
Contributor

@lppedd you can try compiling with Ivy enabled now with Angular version 9.0.0-rc.1. Haven't tested it myself yet, but all the blocking issues seem to be closed now.

@lppedd
Copy link
Contributor

lppedd commented Nov 8, 2019

@Svetomechc oh ok. Thanks! Even the base classes decorators has been solved?

@Svetomechc
Copy link
Contributor

@lppedd I hope.

@lppedd
Copy link
Contributor

lppedd commented Nov 8, 2019

@Svetomechc I haven't seen commits about that here, but I'll try anyway.

@Svetomechc
Copy link
Contributor

@lppedd have you had any success?

@vthinkxie
Copy link
Member

angular/angular#33393 there is still some issue related to ivy
we will start our work to migrate to ivy after 8.5.1 version

@Svetomechc
Copy link
Contributor

Svetomechc commented Nov 11, 2019

@vthinkxie added thumbs up to the issue, hope it gets resolved ASAP.
Forcing every ng-zorro-antd to switch to Observables everywhere is clearly not an option.

@lppedd
Copy link
Contributor

lppedd commented Nov 11, 2019

@Svetomechc that issue is now on v9-blockers, so it will get solved pretty fast I hope!

@wzhudev wzhudev added this to the 9.0.0 milestone Nov 11, 2019
@wzhudev wzhudev assigned hsuanxyz and unassigned wenqi73 Nov 11, 2019
@marcus-sa
Copy link

marcus-sa commented Nov 15, 2019

I'm pretty much just waiting for this, since we've switched over to Bazel and this is blocking us from getting any further.
LMK if you need help with anything.

@wzhudev
Copy link
Member

wzhudev commented Nov 22, 2019

Closed by #4453. We would release a beta version that supports Ivy shortly after. Thanks for your patience and waiting. ❤️

@wzhudev wzhudev closed this as completed Nov 22, 2019
@marcus-sa
Copy link

Awesome! I just finished integrating view engine.. guess I'm gonna go back to Ivy again then, cheers!

@marcus-sa
Copy link

Seems like that didn't resolve the issue 😅

Error: Error on worker #8: Error: Unable to write a reference to NzStringTemplateOutletDirective node_modules/ng-zorro-antd/esm2015/core/addon/string_template_outlet.js from node_modules/ng-zorro-antd/esm2015/core/addon/addon.module.js

@wzhudev
Copy link
Member

wzhudev commented Nov 27, 2019

@marcus-sa Have you tried to remove node_modules and reinstall? Usually this problem comes from an outdated version of @angular/cdk.

@Svetomechc
Copy link
Contributor

@marcus-sa I succesfully enabled Ivy with ng-zorro-antd, ping me if you need any help.

@Svetomechc
Copy link
Contributor

Svetomechc commented Nov 27, 2019

@marcus-sa make sure you updated angular, zone.js, typescript, etc.:

image

image

make sure you have this line in angular.json:

image

not sure if this is still needed, but here's my tsconfig.app.json:

image

delete your package-lock.json / yarn.lock files, remove node_modules directory, run npm i / yarn commands

then your app should run smoothly (first run will take longer to compile. as it will compile your node_modules packages to new format)

@marcus-sa
Copy link

marcus-sa commented Nov 27, 2019

@Svetomechc thanks, but it's weird because I have the exact same versions of the packages installed and it still doesn't work.
The last two steps aren't needed for me since I use Bazel 😄

EDIT:
Works fine when compiling a newly created project using Webpack, but when using ngcc it just fails completely.

@sleekcoda
Copy link

@marcus-sa make sure you updated angular, zone.js, typescript, etc.:

image

image

make sure you have this line in angular.json:

image

not sure if this is still needed, but here's my tsconfig.app.json:

image

delete your package-lock.json / yarn.lock files, remove node_modules directory, run npm i / yarn commands

then your app should run smoothly (first run will take longer to compile. as it will compile your node_modules packages to new format)

Worked like charm all I did was to follow the official documentation of upgrading to angular 9 here

@marcus-sa
Copy link

marcus-sa commented Jan 30, 2020

It no longer works with @angular/compiler-cli@9.0.0-rc.11
When running ngcc --properties es2015 main it seems to only compile these entry points:

Compiling ng-zorro-antd/core/addon : main as umd
Compiling ng-zorro-antd/core/addon : es2015 as esm2015
Compiling ng-zorro-antd/version : main as umd
Compiling ng-zorro-antd/version : es2015 as esm2015

Which results in the following error when trying to import NgZorroAntdModule:

node_modules/ng-zorro-antd/ng-zorro-antd.module.d.ts:72:22 - error NG6003: Appears in the NgModule.exports of SharedModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class

72 export declare class NgZorroAntdModule {
                        ~~~~~~~~~~~~~~~~~

@vthinkxie
Copy link
Member

vthinkxie commented Jan 30, 2020

Hi all, we are working on the ng-zorro-antd v9 now.

anyone who has interest please follow this issue #4634

I believe it would release soon after the angular v9 final version.

@zmzimpl
Copy link

zmzimpl commented Mar 31, 2020

The problem still exis when ngcc, it will thrown an error like this:

Tried to overwrite E:/Project/MstDashboard/node_modules/ng-zorro-antd/esm5/core/addon/classlist_add.js.__ivy_ngcc_bak with an ngcc back up file, which is disallowed.

but it could be solved by delete node_modules and then reinstall

@BrsJsk
Copy link

BrsJsk commented Apr 15, 2020

It's not still safe to use ng zorro with angular 9 ?

@hsuanxyz
Copy link
Member

It's not still safe to use ng zorro with angular 9 ?

We will release stable version(9.0.0) today

@Svitra
Copy link

Svitra commented Apr 16, 2020

It's not still safe to use ng zorro with angular 9 ?

We will release stable version(9.0.0) today

Hi, with the version 9 and Angular 9 (ivy enabled) I am now getting the following error:
Error: Tried to write .../node_modules/ng-zorro-antd/core/no-animation/nz-no-animation.directive.d.ts.__ivy_ngcc_bak with an ngcc back up file but it already exists so not writing, nor backing up, .../node_modules/ng-zorro-antd/core/no-animation/nz-no-animation.directive.d.ts.
This error may be because two or more entry-points overlap and ngcc has been asked to process some files more than once.
You should check other entry-points in this package and set up a config to ignore any that you are not using.

And then I get a bunch of other errors all related to nz-no-animation.directive.js

I tried removing node_modules folder and running a clean install but when i run ngcc i get the same result. That is a really big blocker for me. Can you please advise?

@BrsJsk
Copy link

BrsJsk commented Apr 16, 2020

It's not still safe to use ng zorro with angular 9 ?

We will release stable version(9.0.0) today

Hi, with the version 9 and Angular 9 (ivy enabled) I am now getting the following error:
Error: Tried to write .../node_modules/ng-zorro-antd/core/no-animation/nz-no-animation.directive.d.ts.__ivy_ngcc_bak with an ngcc back up file but it already exists so not writing, nor backing up, .../node_modules/ng-zorro-antd/core/no-animation/nz-no-animation.directive.d.ts.
This error may be because two or more entry-points overlap and ngcc has been asked to process some files more than once.
You should check other entry-points in this package and set up a config to ignore any that you are not using.

And then I get a bunch of other errors all related to nz-no-animation.directive.js

I tried removing node_modules folder and running a clean install but when i run ngcc i get the same result. That is a really big blocker for me. Can you please advise?

Is ngcc required to run? I think its more of a good thing to do for faster build time ?

@Svitra
Copy link

Svitra commented Apr 16, 2020

Unfortunately I get the same errors also during build and running unit tests while the dependencies are compiled so despite the unit tests passing the pipelines are failing due to these errors.

@hsuanxyz
Copy link
Member

@Svitra @BrsJsk #5045, we will fix it soon

@zmzimpl
Copy link

zmzimpl commented Apr 20, 2020

@Svitra @BrsJsk #5045, we will fix it soon

Has the problem been solved? This error is still thrown when I run ngcc after upgrading to 9:
Error on worker #5: Error: Tried to overwrite E:/Project/MstDashboard/node_modules/ng-zorro-antd/core/no-animation/nz-no-animation.directive.d.ts.__ivy_ngcc_bak with an ngcc back up file, which is disallowed.

@hsuanxyz
Copy link
Member

@zmzimpl It will be fixed in the next version(9.0.2), you can subscribe to the release notifications

@zmzimpl
Copy link

zmzimpl commented Apr 20, 2020

@zmzimpl It will be fixed in the next version(9.0.2), you can subscribe to the release notifications

OK,thanks,It also seems to throw this error:
Error: Error on worker #2: Error: Tried to overwrite E:/Project/MstDashboard/node_modules/ng-zorro-antd/fesm2015/ng-zorro-antd-icon.js.__ivy_ngcc_bak with an ngcc back up file, which is disallowed.

@hsuanxyz
Copy link
Member

@zmzimpl Looks like a common error on ivy, could you delete the node_modules and retry?

@zmzimpl
Copy link

zmzimpl commented Apr 20, 2020

@zmzimpl Looks like a common error on ivy, could you delete the node_modules and retry?

I tried deleting node_modules, but it still throw this error. At this time, my angular / cli version is 9.1.1. When I roll back the antd version to 8.5.2, it will throw There was an error related to addon, but in angular cli 9.0.4, after deleting node_modules and reinstalling it, ivy works fine again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests