Skip to content

Ng 8.0 + ivy + library Error : does not have 'ngModuleDef' property #14594

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

Closed
keatkeat87 opened this issue May 30, 2019 · 8 comments · Fixed by #14721 or #14755
Closed

Ng 8.0 + ivy + library Error : does not have 'ngModuleDef' property #14594

keatkeat87 opened this issue May 30, 2019 · 8 comments · Fixed by #14721 or #14755
Assignees
Labels
area: @ngtools/webpack feature Issue that requests a new feature
Milestone

Comments

@keatkeat87
Copy link

🐞 bug report

Is this a regression?

no

Description

this is a simple test ng 8.0 + ivy + library. is it ivy supported custom library ?
this is the error message i get :
Error: Type MyLibModule does not have 'ngModuleDef' property.
if i turn off ivy, all work fine

🔬 Minimal Reproduction

https://github.com/keatkeat87/angular-ivy-library-issue

step :
ng new library-and-project-issue --enable-ivy
cd library-and-project-issue
ng g library my-lib
ng build my-lib

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { MyLibModule } from 'my-lib'; // add

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    MyLibModule  // add
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

ng serve --open

Angular Version:
Angular CLI: 8.0.0
Node: 12.3.1
OS: win32 x64
Angular:
...

Package Version

@angular-devkit/architect 0.800.0
@angular-devkit/core 8.0.0
@angular-devkit/schematics 8.0.0
@schematics/angular 8.0.0
@schematics/update 0.800.0
rxjs 6.4.0

@JoostK
Copy link
Member

JoostK commented May 30, 2019

Libraries outside of node_modules that are made available using paths-mapping are not currently processed by ngcc, so they are not compiled for Ivy usage. For the time being you can run ./node_modules/.bin/ivy-ngcc -s ./dist each time after building the library and before serving.

@keatkeat87
Copy link
Author

keatkeat87 commented May 30, 2019

oic, any road map for this feature ?
./node_modules/.bin/ivy-ngcc -s ./dist <-- it work, but ... i can't do this all day ... /.\

@JoostK
Copy link
Member

JoostK commented May 30, 2019

@manughub could this be moved to @angular/angular-cli, as it is caused by how @ngtools/webpack processes modules.

@filipesilva filipesilva transferred this issue from angular/angular May 30, 2019
@ngbot ngbot bot added this to the needsTriage milestone May 30, 2019
@filipesilva filipesilva added feature Issue that requests a new feature and removed devkit/build-angular:library labels May 30, 2019
@ngbot ngbot bot modified the milestones: needsTriage, Backlog May 30, 2019
@filipesilva
Copy link
Contributor

I've moved this issue to the CLI repo. We don't yet have good support for Ivy libraries in the CLI.

@alan-agius4
Copy link
Collaborator

alan-agius4 commented May 31, 2019

Hi @keatkeat87, yes this is something in the roadmap to add ngcc processing on workspace libraries. We are targeting this for 8.1

Thanks

@vytautas-pranskunas-

This comment has been minimized.

kyliau pushed a commit that referenced this issue Jun 11, 2019
In version 8.1, similar to TypeScript Compiler, NGCC supports Path Mappings. This enable NGCC to process workspace libraries similar to what it is currently being done for `node_modules`

Closes #14594
@alan-agius4
Copy link
Collaborator

Going to re-open this as it's seems that it is not fully resolved

#14755

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
ikjelle pushed a commit to ikjelle/angular-cli that referenced this issue Mar 26, 2024
In version 8.1, similar to TypeScript Compiler, NGCC supports Path Mappings. This enable NGCC to process workspace libraries similar to what it is currently being done for `node_modules`

Closes angular#14594
ikjelle pushed a commit to ikjelle/angular-cli that referenced this issue Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @ngtools/webpack feature Issue that requests a new feature
Projects
None yet
5 participants