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.

Can't find *.ngfactory.js after bundling module!

See original GitHub issue

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

_A bug: After publishing a module and try testing it using ng serve --aot i get errors

ERROR in ./src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve 'ngx-pickydate' in '/home/ahmed/WWW/ngx-pickydate/src/app'
ERROR in ./src/app/app.component.ngfactory.js
Module not found: Error: Can't resolve 'ngx-pickydate' in '/home/ahmed/WWW/ngx-pickydate/src/app'
ERROR in ./src/app/ngx-pickydate/@ngx-pickydate/ngx-pickydate.ngfactory.js
Module not found: Error: Can't resolve 'ngx-pickydate' in '/home/ahmed/WWW/ngx-pickydate/src/app/ngx-pickydate/@ngx-pickydate'
ℹ 「wdm」: Failed to compile.

The module run fine without ‘Ahead of Time’ compilation. i mean with ng serve

How To Reproduce

_A bug: ng serve --aot

Expected Behaviour

A bug: please describe what behaviour or result you expected After reading a bit about this error i found that this part inside tsconfig.json

"angularCompilerOptions": {
  "genDir": "compiled"
}

is responsible of generating ngFactory.js files. so do i miss something here !??

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr:            2.4.5
@angular/compiler:     6.0.3
@angular/compiler-cli: 6.0.3
rollup:                0.55.5
tsickle:               0.27.5
typescript:            2.7.2

No third party library.

package.json of the modal

{
    "$schema": "./node_modules/ng-packagr/package.schema.json",
    "name": "ngx-pickydate",
    "version": "1.0.5",
    "ngPackage": {
      "lib": {
        "entryFile": "index.ts"
      },
      "dest": "@ngx-pickydate"
    }
  }

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "genDir": "compiled",
    "fullTemplateTypeCheck": true,
    "preserveWhitespaces": true
  }
}

package.json of the main project

{
  "name": "testpackage",
  "version": "1.0.2",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "bundle": "ng-packagr -p src/app/ngx-pickydate/package.json"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.0",
    "@angular/common": "^6.0.0",
    "@angular/compiler": "^6.0.0",
    "@angular/core": "^6.0.0",
    "@angular/forms": "^6.0.0",
    "@angular/http": "^6.0.0",
    "@angular/platform-browser": "^6.0.0",
    "@angular/platform-browser-dynamic": "^6.0.0",
    "@angular/router": "^6.0.0",
    "core-js": "^2.5.4",
    "rxjs": "^6.0.0",
    "zone.js": "^0.8.26"
  },
  "lib": {
    "entryFile": "ngx-pickydate.ts"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.0",
    "@angular/cli": "~6.0.0",
    "@angular/compiler-cli": "^6.0.3",
    "@angular/language-service": "^6.0.0",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~1.4.2",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "ng-packagr": "^2.4.5",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslib": "^1.9.1",
    "tslint": "~5.9.1",
    "typescript": "^2.7.2"
  }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alan-agius4commented, May 30, 2018

No problem, I don’t particular have any links. I suggest maybe to that a look at medium.com

1reaction
AhmedBHameedcommented, May 30, 2018

This is for angular 6 i guess! I tried to bundle it using rollup task bundler but i stuck somewhere that i could not find much info. Do you have links to start reading more about ? BTW thank you for helping me and for your time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 8 using Ivy module.ngfactory cannot find
ngfactory '. I try to enable ivy, by adding angularCompilerOptions section to enableIvy to be true, and that is when I get this...
Read more >
nguniversal/module-map-ngfactory-loader
Start using @nguniversal/module-map-ngfactory-loader in your project ... require('main.bundle.js'); renderModuleFactory(AppModuleNgFactory, ...
Read more >
angular/angular-cli - Gitter
When I do a ng build, the core bundles are located just fine through the ... "Cannot find module '@angular-cli/ast-tools'" bug fixed in...
Read more >
Angular CLI: "Module not found: Error: Can't resolve..."
In this article, I will walk you through how to fix an error that many people are encountering after the release of Angular...
Read more >
Building an Angular Application for Production - Minko Gechev
Our build script first cleans the dist directory and after that ... graphs module from the final bundle since we're not using Graphs ......
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