Skip to content

Getting WARNINGs in ./src/app/app.module.ngfactory.js and *lib.ngfactory.js with ng build --prod, won't happen with ng build #11394

@netpoe

Description

@netpoe

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Area

- [x] devkit
- [ ] schematics

Versions

npm 6.1.0
macOS High Sierra
Angular CLI: 6.0.8
Node: 8.10.0
OS: darwin x64
Angular: 6.0.6
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cli 6.0.8
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.2.1
typescript 2.7.2
webpack 4.8.3

Repro steps

I created an angular library ng generate library common-lib --prefix=canyalib

Added these components and services to the library module

Exported them in the public_api.ts

Used the library components successfully in the project app

The CommonLibModule is imported in the app.module.ts

Ran ng build --prod common-lib and got no errors

Packaged the library and published it to the npm registry npm run package

"scripts": {
    "build_lib": "ng build --prod common-lib",
    "npm_pack": "cd dist/common-lib && npm pack",
    "package": "npm run build_lib && npm run npm_pack"

Installed the angular library in another Angular 6 app with: npm install @canyaio/common-lib@0.1.3

Added the CommonLibModule to the app.module.ts as well as in other app modules through a shared module.

I run ng serve or ng build and I get no errors. I can even deploy the app to firebase.

I run ng serve --prod or ng build --prod and:

The log given by the failure

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
 92% chunk asset optimization UglifyJSPlugin 「wdm」: wait until bundle finished: /assets/i18n/es_ES.json

Date: 2018-06-27T22:55:43.231Z
Hash: 36fd56e26b227869b568
Time: 227060ms
chunk {0} runtime.a66f828dca56eeb90e02.js (runtime) 1.05 kB [entry] [rendered]
chunk {1} styles.3b401f7315e1889fc196.css (styles) 184 kB [initial] [rendered]
chunk {2} polyfills.16be5397c080c6bf4c93.js (polyfills) 59.8 kB [initial] [rendered]
chunk {3} main.9918d4723eeee42a175e.js (main) 4.36 MB [initial] [rendered]

WARNING in ./node_modules/@canyaio/common-lib/canyaio-common-lib.ngfactory.js
132:230-248 "export 'FooterComponent' (imported as 'i1') was not found in '@canyaio/common-lib'

WARNING in ./node_modules/@canyaio/common-lib/canyaio-common-lib.ngfactory.js
133:86-104 "export 'FooterComponent' (imported as 'i1') was not found in '@canyaio/common-lib'

WARNING in ./node_modules/@canyaio/common-lib/canyaio-common-lib.ngfactory.js
17:1349-1369 "export 'HttpLoaderFactory' (imported as 'i1') was not found in '@canyaio/common-lib'

WARNING in ./src/app/missing-metamask/container.component.ngfactory.js
17:1812-1830 "export 'FooterComponent' (imported as 'i3') was not found in '@canyaio/common-lib'

WARNING in ./src/app/document-index/documents-index-wrapper/documents-index-wrapper.component.ngfactory.js
28:2029-2048 "export 'FooterComponent' (imported as 'i14') was not found in '@canyaio/common-lib'

WARNING in ./src/app/document-request-signatures/documents-request-signatures-wrapper/documents-request-signatures-wrapper.component.ngfactory.js
31:2021-2040 "export 'FooterComponent' (imported as 'i17') was not found in '@canyaio/common-lib'

WARNING in ./src/app/document-sign/documents-sign-wrapper/documents-sign-wrapper.component.ngfactory.js
32:1994-2013 "export 'FooterComponent' (imported as 'i18') was not found in '@canyaio/common-lib'

WARNING in ./src/app/app.module.ngfactory.js
46:3726-3747 "export 'HttpLoaderFactory' (imported as 'i15') was not found in '@canyaio/common-lib'
「wdm」: Compiled with warnings.

Desired functionality

This error won't let me run the app with library modules in a production environment.

Mention any other details that might be useful

The library I created and I'm importing to the external app is using @ngx-translate/core and @ngx-translate/http-loader

But the problem is with the FooterComponent and HttpLoaderFactory in the WARNINGS.

Additionally. As I'm getting only WARNINGs, I can deploy my ng build --prod app to firebase, but the app won't run. The browser console is full of errors:

main.9918d4723eeee42a175e.js:1 Invalid asm.js: Unexpected token
main.9918d4723eeee42a175e.js:1 ERROR Error: StaticInjectorError(i)[e -> e]: 
  StaticInjectorError(Platform: core)[e -> e]: 
    NullInjectorError: No provider for e!
    at e.get (main.9918d4723eeee42a175e.js:1)
    at main.9918d4723eeee42a175e.js:1
    at e (main.9918d4723eeee42a175e.js:1)
    at e.get (main.9918d4723eeee42a175e.js:1)
    at main.9918d4723eeee42a175e.js:1
    at e (main.9918d4723eeee42a175e.js:1)
    at e.get (main.9918d4723eeee42a175e.js:1)
    at Ir (main.9918d4723eeee42a175e.js:1)
    at e.get (main.9918d4723eeee42a175e.js:1)
    at bi (main.9918d4723eeee42a175e.js:1)
re @ main.9918d4723eeee42a175e.js:1
main.9918d4723eeee42a175e.js:1 Error: StaticInjectorError(i)[e -> e]: 
  StaticInjectorError(Platform: core)[e -> e]: 
    NullInjectorError: No provider for e!
    at e.get (main.9918d4723eeee42a175e.js:1)
    at main.9918d4723eeee42a175e.js:1
    at e (main.9918d4723eeee42a175e.js:1)
    at e.get (main.9918d4723eeee42a175e.js:1)
    at main.9918d4723eeee42a175e.js:1
    at e (main.9918d4723eeee42a175e.js:1)
    at e.get (main.9918d4723eeee42a175e.js:1)
    at Ir (main.9918d4723eeee42a175e.js:1)
    at e.get (main.9918d4723eeee42a175e.js:1)
    at bi (main.9918d4723eeee42a175e.js:1)
main.9918d4723eeee42a175e.js:1 [WDS] Warnings while compiling.
warnings @ main.9918d4723eeee42a175e.js:1
main.9918d4723eeee42a175e.js:1 ./node_modules/@canyaio/common-lib/canyaio-common-lib.ngfactory.js
132:230-248 "export 'FooterComponent' (imported as 'i1') was not found in '@canyaio/common-lib'
warnings @ main.9918d4723eeee42a175e.js:1
main.9918d4723eeee42a175e.js:1 ./node_modules/@canyaio/common-lib/canyaio-common-lib.ngfactory.js
133:86-104 "export 'FooterComponent' (imported as 'i1') was not found in '@canyaio/common-lib'
warnings @ main.9918d4723eeee42a175e.js:1
main.9918d4723eeee42a175e.js:1 ./node_modules/@canyaio/common-lib/canyaio-common-lib.ngfactory.js
17:1349-1369 "export 'HttpLoaderFactory' (imported as 'i1') was not found in '@canyaio/common-lib'
warnings @ main.9918d4723eeee42a175e.js:1
main.9918d4723eeee42a175e.js:1 ./src/app/missing-metamask/container.component.ngfactory.js
17:1812-1830 "export 'FooterComponent' (imported as 'i3') was not found in '@canyaio/common-lib'
warnings @ main.9918d4723eeee42a175e.js:1
main.9918d4723eeee42a175e.js:1 ./src/app/document-index/documents-index-wrapper/documents-index-wrapper.component.ngfactory.js
28:2029-2048 "export 'FooterComponent' (imported as 'i14') was not found in '@canyaio/common-lib'
warnings @ main.9918d4723eeee42a175e.js:1
main.9918d4723eeee42a175e.js:1 ./src/app/document-request-signatures/documents-request-signatures-wrapper/documents-request-signatures-wrapper.component.ngfactory.js
31:2021-2040 "export 'FooterComponent' (imported as 'i17') was not found in '@canyaio/common-lib'
warnings @ main.9918d4723eeee42a175e.js:1
main.9918d4723eeee42a175e.js:1 ./src/app/document-sign/documents-sign-wrapper/documents-sign-wrapper.component.ngfactory.js
32:1994-2013 "export 'FooterComponent' (imported as 'i18') was not found in '@canyaio/common-lib'
warnings @ main.9918d4723eeee42a175e.js:1
main.9918d4723eeee42a175e.js:1 ./src/app/app.module.ngfactory.js
46:3726-3747 "export 'HttpLoaderFactory' (imported as 'i15') was not found in '@canyaio/common-lib'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions