-
Notifications
You must be signed in to change notification settings - Fork 12k
Getting WARNINGs in ./src/app/app.module.ngfactory.js and *lib.ngfactory.js with ng build --prod
, won't happen with ng build
#11394
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
Comments
Can you try to remove the barrel files (aka export * from) Unfortunitly there are a lot of issues when using barrel files and generating metadata. Such as; angular/angular#23713 & And this might very well be one of those. Unfortunately I cannot test it right away my self. |
@alan-agius4 thanks for the references. I've checked my project library and updated the only barrels I found: projects/common-lib/src/lib/public_api.ts
To:
Packaged the library, published it, installed it and
What's funny though, is that the packager did this in the
|
The following is normal when building in AOT.
I tried to look into this, but the app provided has too has too many unrelated errors. Can you setup a minimal reproduction please? You can read here why this is needed. A good way to make a minimal reproduction is to create a new app via |
@alan-agius4 sure! Actually, I made some progress using the library in a different Angular 6 app. You should be able to run both by cloning them, npm installing them and ng serving them. In this app: https://github.com/canyaio/CANShare/blob/master/src/app/app.module.ts#L24 One important thing to notice here is that the app consists of only 1 module, the app.module.ts Now, take a look at this Angular 6 app, the one that has the warnings: https://github.com/canyaio/CANSign/tree/master/src/app It's importing the same CommonLibModule, however this app has multiple modules apart from the app.module.ts.
Could it be something with child modules? Am I exporting the library suitable for child modules? https://github.com/canyaio/Common/tree/master/projects/common-lib/src |
I tried to look at this and once again the git repository provided is full of unrelated errors. Such as;
And If I fix that more errors pop-up. Please provide a reproduction with the bare minimum needed to get the errors. A good way to start is using |
@alan-agius4 I made it work by Suddenly worked without warnings and no errors. Seemed like a cache issue. Thanks for your help |
Had the same issue with a own shared library, only appeared in one of our apps running that lib version. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Area
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.tsRan
ng build --prod common-lib
and got no errorsPackaged the library and published it to the npm registry
npm run package
Installed the angular library in another Angular 6 app with:
npm install @canyaio/[email protected]
Added the
CommonLibModule
to theapp.module.ts
as well as in other app modules through a shared module.I run
ng serve
orng build
and I get no errors. I can even deploy the app to firebase.I run
ng serve --prod
orng build --prod
and:The log given by the failure
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
andHttpLoaderFactory
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:The text was updated successfully, but these errors were encountered: