Angular 9 Ivy: IntelliJ stops compiling dependencies

This is driving me crazy...

For the fifth time now I've created a new Angular project with IntelliJ and added the NG-Zorro framework. I can add some modules to my app.module.ts and I can see that some libraries are getting compiled, resulting in declarations like this:

export declare class NzLayoutModule {
static ɵmod: ɵngcc0.ɵɵNgModuleDefWithMeta<NzLayoutModule, [typeof ɵngcc1.NzLayoutComponent, typeof ɵngcc2.NzHeaderComponent, typeof ɵngcc3.NzContentComponent, typeof ɵngcc4.NzFooterComponent, typeof ɵngcc5.NzSiderComponent, typeof ɵngcc6.NzSiderTriggerComponent], [typeof ɵngcc7.CommonModule, typeof ɵngcc8.NzIconModule, typeof ɵngcc9.LayoutModule, typeof ɵngcc10.PlatformModule], [typeof ɵngcc1.NzLayoutComponent, typeof ɵngcc2.NzHeaderComponent, typeof ɵngcc3.NzContentComponent, typeof ɵngcc4.NzFooterComponent, typeof ɵngcc5.NzSiderComponent]>;
static ɵinj: ɵngcc0.ɵɵInjectorDef<NzLayoutModule>;

There is also another file there, with the ending "d.ts.__ivy_ngcc_bak". Everything looks good.

However, whenever I add another reference to a Zorro-Module nothing more happens. I get an error in my module importing the other module:

Class NzTableModule is not an Angular module

Looking at the module file it looks like this:

export declare class NzTableModule {

There is also no other file with this ending like above.

Is there anything I can do here? As I said, these are fresh projects, I only added the NG-Zorro dependency.

I've just did another "ng build" and now, finally, this is the output:

Compiling ng-zorro-antd/core/transition-patch : es2015 as esm2015

Compiling ng-zorro-antd/core/wave : es2015 as esm2015

Compiling ng-zorro-antd/button : es2015 as esm2015

Compiling @angular/cdk/observers : es2015 as esm2015

Compiling @angular/cdk/a11y : es2015 as esm2015

Compiling ng-zorro-antd/checkbox : es2015 as esm2015

Compiling ng-zorro-antd/core/resize-observers : es2015 as esm2015

Compiling ng-zorro-antd/dropdown : es2015 as esm2015

Compiling ng-zorro-antd/empty : es2015 as esm2015

Compiling ng-zorro-antd/select : es2015 as esm2015

Compiling ng-zorro-antd/pagination : es2015 as esm2015

Compiling ng-zorro-antd/radio : es2015 as esm2015

Compiling ng-zorro-antd/spin : es2015 as esm2015

Compiling ng-zorro-antd/table : es2015 as esm2015

So now IntelliJ recognizes the modules. Is there anything I can do to somehow automate this? Tell IntelliJ to run the compiler when I add a module?

Comment actions Permalink

Not sure what it has to do with IDEA... It's not the IDE that builds your app, you have to run `ng build` explicitly to do this. If this command doesn't work as expected, I'd suggest filing the issue to Angular team (or to if the issue is specific to NG-Zorro framework)

Comment actions Permalink

Well, I would expect from IDEA that, whenever I import a module that is offered via Intellisens, it ensures that I can use components from this module by, e.g., calling the compiler or offereing a Quickfix that does this.

Currently it just says "This is no module, sorry". I thought it could handle the Ivy compiler.

Comment actions Permalink

No, you are expecting too much from the IDE. It can assist you with auto-importing the exported module, but it's not supposed to start custom build processes if something goes wrong with your code

Comment actions Permalink

Hm, I've just tested this on my MacBook and everything works. On my other machine (Windows) I'm seeing the problems stated above that IntelliJ does not recognize the modules. It seems like it's independent from compiling, on Mac no additional files are generated and the module files are still plain classes without the additional static properties shown in the first example.

I have to compare both setups to hopefully find out whats going wrong on the Windows machine...


Please sign in to leave a comment.