jvandemo / jvandemo/generator-angular2-library

Angular CLI 1.2.6 Build AOT Fail

Open
#181 12 comments 4 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
740
Forks
116
PR merge metrics
No merged PRs in 30d

Description

Hi,

I create a pacakge with your generator and publish it to an local artifactory.
I can import it, use it in dev mode, but I try to do ng build --prod to build in aot mode I have some error prompt.
It say that Cannot Find oel-gabarits on some component of my application and error inside the nodes_modules...

Here's a copy paste of the log in my console

`ng build --prod`
`Hash: 16a5b46d4ed9799a9444`
`Time: 15042ms`
`chunk {0} polyfills.86c0b4d44f70fee7f41e.bundle.js (polyfills) 255 kB {4} [initial] [rendered]`
`chunk {1} main.3c31870d629bceebe9f8.bundle.js (main) 256 kB {3} [initial] [rendered]`
`chunk {2} styles.acbe024ab0f7dafcc3aa.bundle.css (styles) 69 bytes {4} [initial] [rendered]`
`chunk {3} vendor.52c64a0afab9cdf1414c.bundle.js (vendor) 1.31 MB [initial] [rendered]`
`chunk {4} inline.46e0b4bbe8a4c486211c.bundle.js (inline) 0 bytes [entry] [rendered]`

`ERROR in C:/Desjardins/dev/FondsDesjardins/fonds-desjardins-extranet/formulaires/choix-investissement-helios2/src/$$_gendir/app/solution-investissement/solution-investissement.component.ngfactory.ts (12,21): Cannot find module 'oel-gabarits'.`

`ERROR in C:/Desjardins/dev/FondsDesjardins/fonds-desjardins-extranet/formulaires/choix-investissement-helios2/src/$$_gendir/node_modules/oel-gabarits-temp/oel-gabarits.ngfactory.ts (10,21): Cannot find module 'oel-gabarits'.`

`ERROR in C:/Desjardins/dev/FondsDesjardins/fonds-desjardins-extranet/formulaires/choix-investissement-helios2/src/$$_gendir/app/app.module.ngfactory.ts (26,22): Cannot find module 'oel-gabarits'.`

`ERROR in C:/Desjardins/dev/FondsDesjardins/fonds-desjardins-extranet/formulaires/choix-investissement-helios2/src/$$_gendir/app/app.module.ngfactory.ts (26,22): Cannot find module 'oel-gabarits'.`

`ERROR in C:/Desjardins/dev/FondsDesjardins/fonds-desjardins-extranet/formulaires/choix-investissement-helios2/src/$$_gendir/app/solution-investissement/solution-investissement.component.ngfactory.ts (12,21): Cannot find module 'oel-gabarits'.`

`ERROR in C:/Desjardins/dev/FondsDesjardins/fonds-desjardins-extranet/formulaires/choix-investissement-helios2/src/$$_gendir/node_modules/oel-gabarits-temp/oel-gabarits.ngfactory.ts (10,21): Cannot find module 'oel-gabarits'.`

`ERROR in ./src/$$_gendir/app/app.module.ngfactory.ts
Module not found: Error: Can't resolve 'oel-gabarits' in 'C:\Desjardins\dev\FondsDesjardins\fonds-desjardins-extranet\formulaires\choix-investissement-helios2\src\$$_gendir\app'
@ ./src/$$_gendir/app/app.module.ngfactory.ts 24:0-36
@ ./src/main.ts
@ multi ./src/main.ts`

`ERROR in ./src/$$_gendir/app/solution-investissement/solution-investissement.component.ngfactory.ts
Module not found: Error: Can't resolve 'oel-gabarits' in 'C:\Desjardins\dev\FondsDesjardins\fonds-desjardins-extranet\formulaires\choix-investissement-helios2\src\$$_gendir\app\solution-investissement'
@ ./src/$$_gendir/app/solution-investissement/solution-investissement.component.ngfactory.ts 10:0-35
@ ./src/$$_gendir/app/app.module.ngfactory.ts
@ ./src/main.ts
@ multi ./src/main.ts`

`ERROR in ./src/$$_gendir/~/oel-gabarits-temp/oel-gabarits.ngfactory.ts
Module not found: Error: Can't resolve 'oel-gabarits' in 'C:\Desjardins\dev\FondsDesjardins\fonds-desjardins-extranet\formulaires\choix-investissement-helios2\src\$$_gendir\node_modules\oel-gabarits-temp'
@ ./src/$$_gendir/~/oel-gabarits-temp/oel-gabarits.ngfactory.ts 8:0-35
@ ./src/$$_gendir/app/solution-investissement/solution-investissement.component.ngfactory.ts
@ ./src/$$_gendir/app/app.module.ngfactory.ts
@ ./src/main.ts
@ multi ./src/main.ts`

Does someone have this issue and how to fix it ?

Thank you !

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported `ng build --prod` failure with Angular CLI 1.2.6 and inspect the generated `src/$$_gendir` ngfactory files and the published package. Trace why those generated imports cannot resolve `oel-gabarits`; done means the generated library builds successfully in AOT mode without the reported module errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.