question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular cli 5 AOT gives Module not found can't resolve .ngfactory

See original GitHub issue

Type of Issue

[X] Bug Report
[ ] Feature Request

Description

When building bundle with ng-packagr, installing it in Angular 5 app and then trying to AOT the application, the compiler throws the error that it’s not able to find the referenced module.

How To Reproduce

  1. “ng-packagr -p ng-package.json” bundle and npm publish
  2. Install on new Angular 5 app (i.e. npm install)
  3. Using ngTools webpack 1.8.0 AOT the application
  4. Get errror. Example: image

Expected Behaviour

Should not display message since bundle is already build

Version Information

ng-packagr: v2.0.0-rc.0
node: v8.8.1
@angular: v5.0.1
rxjs: v5.5.2
zone.js: v0.8.18
typescript: v2.6.1

Workaround: https://github.com/angular/angular-cli/issues/8284#issuecomment-341417325

Which is to include the library in the Include files of the tsconfig compilation

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
macjohnnycommented, Nov 17, 2017

removing "rootDir": "./src", from the tsconfig.json resolved the problem for us

0reactions
github-actions[bot]commented, Sep 20, 2021

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

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

27 - Stack Overflow
When you run the ng build in angular 2, latest angular-cli automatically runs with --aot ... src/main.server.ts Module not found: Error: Can't resolve...
Read more >
How to fix Ionic --prod Error: Module not found: module.ngfactory
I Honestly don't quite know which Angular AoT rule this breaks (AoT if used with the --prod flag) but if you have a...
Read more >
angular/angular - Gitter
newly created project throws this. ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in ...
Read more >
Switching from angular2-template-loader to @ngtools/webpack
Module not found : Error: Can't resolve './main.ts.ngfactory' in '/path/to/application/directory'. Another strange problem that I don't ...
Read more >
how should I generate the app.module.ngfactory.ts file? - Reddit
I'm trying to get my ng2 app set up for AOT. It seems that an app.module.ngfactory.ts file is needed for this instead of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found