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

A "Can't resolve './app/app.module.ngfactory'" error occurs When AOT with private package #230

Closed
AaronJin2013 opened this issue Jan 25, 2018 · 3 comments

Comments

@AaronJin2013
Copy link

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

I can use the private package with ng serve or ng build, but when I use ng serve -aot or ng build -prod,will put error like this.

ERROR in ./apps/myapp/src/main.ts
Module not found: Error: Can't resolve './app/app.module.ngfactory' in '/Users/aaronjin/aaronjin2013/NX-packagr/apps/myapp/src'
resolve './app/app.module.ngfactory' in '/Users/aaronjin/aaronjin2013/NX-packagr/apps/myapp/src'
  using description file: /Users/aaronjin/aaronjin2013/NX-packagr/package.json (relative path: ./apps/myapp/src)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Users/aaronjin/aaronjin2013/NX-packagr/package.json (relative path: ./apps/myapp/src)
    using description file: /Users/aaronjin/aaronjin2013/NX-packagr/package.json (relative path: ./apps/myapp/src/app/app.module.ngfactory)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /Users/aaronjin/aaronjin2013/NX-packagr/apps/myapp/src/app/app.module.ngfactory doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        /Users/aaronjin/aaronjin2013/NX-packagr/apps/myapp/src/app/app.module.ngfactory.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /Users/aaronjin/aaronjin2013/NX-packagr/apps/myapp/src/app/app.module.ngfactory.js doesn't exist
      as directory
        /Users/aaronjin/aaronjin2013/NX-packagr/apps/myapp/src/app/app.module.ngfactory doesn't exist
[/Users/aaronjin/aaronjin2013/NX-packagr/apps/myapp/src/app/app.module.ngfactory]
[/Users/aaronjin/aaronjin2013/NX-packagr/apps/myapp/src/app/app.module.ngfactory.ts]
[/Users/aaronjin/aaronjin2013/NX-packagr/apps/myapp/src/app/app.module.ngfactory.js]
[/Users/aaronjin/aaronjin2013/NX-packagr/apps/myapp/src/app/app.module.ngfactory]
 @ ./apps/myapp/src/main.ts 3:0-66
 @ multi ./apps/myapp/src/main.ts

I can't understand Why does it happen,maybe because Version conflict?

This package is a feature module,develop in libs,has NgModule,RouterModule,StoreModule,and use ng-packagr package it.

How To Reproduce

I push the code to this repo
NX-packagr

Expected Behaviour

I would like to have successful AOT compile.

Version Information

ng-packagr: 1.6.0
@angular/*: 5.1.0
typescript: 2.5.3
rxjs: 5.5.2
node: 7.8.0
npm/yarn: 5.6.0
nrwl/nx:0.6.19
ngrx:4.1.1
@vsavkin
Copy link
Member

vsavkin commented Feb 19, 2018

Angular 5.1 and CLI 1.5 had an issue where sometimes they would mask an error. The compilation would fail and the factory file would not be generated. The CLI would not show the source of the problem--only the fact that the file isn't there.

Could you upgrade to Nx 0.7.0 (and run nx-migrate after)? I'll switch switch your project to use the newer CLI and the newer Angular.

@thelgevold
Copy link
Contributor

Closing due to inactivity.

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants