Angular 10 optimization warnings
michaelfaith opened this issue · comments
Bug Report or Feature Request (mark with an x
)
- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] question
OS and Version?
Windows 10
Versions
Angular CLI: 10.0.1
Node: 12.13.0
OS: win32 x64
Angular: 10.0.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
@angular-devkit/architect 0.1000.1
@angular-devkit/build-angular 0.1000.1
@angular-devkit/build-ng-packagr 0.1000.1
@angular-devkit/build-optimizer 0.1000.1
@angular-devkit/build-webpack 0.1000.1
@angular-devkit/core 10.0.1
@angular-devkit/schematics 10.0.1
@angular/cdk 10.0.1
@angular/cli 10.0.1
@angular/flex-layout 10.0.0-beta.32
@angular/material 10.0.1
@ngtools/webpack 10.0.1
@schematics/angular 10.0.1
@schematics/update 0.1000.1
ng-packagr 10.0.0
rxjs 6.5.5
typescript 3.9.5
webpack 4.43.0
Repro steps
ng build when library is included.
The log given by the failure
Start of build warning:
Warning: Entry point 'ngx-highlightjs' contains deep imports into 'C:/Users/<username>/src/fabric/ui/node_modules/highlight.js/lib/highlight'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
Post-build warnings:
WARNING in C:\Users\<username>\src\fabric\ui\node_modules\ngx-highlightjs\fesm2015\ngx-highlightjs.js depends on 'highlight.js'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
WARNING in C:\Users\<username>\src\fabric\ui\node_modules\ngx-highlightjs\fesm2015\ngx-highlightjs.js depends on 'highlight.js/lib/highlight'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Desired functionality
Not sure if this is actually causing an issue, but I'm seeing these in my logs every ng build. Seems like the cli isn't liking the way the dependency is referenced.
In Angular 10, add the following to avoid the warning
{
"projects": {
"project-name": {
"architect": {
"build": {
"allowedCommonJsDependencies": [
"highlight.js"
]
}
}
}
}
}