-
Notifications
You must be signed in to change notification settings - Fork 120
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
depends on 'highcharts'. CommonJS or AMD dependencies can cause optimization bailouts #223
Comments
Since Angular 10 the Angular CLI outputs warnings if it detects that your browser application depends on CommonJS modules. We are currently in the middle of migration to the ES-modules, but for now, the only thing that could be done is disabling these warnings. To make it work you can add the CommonJS module name to allowedCommonJsDependencies option in the build options located in the Official guide of configuring the commonJS dependencies: //angular.json
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": [
"highcharts"
]
...
}
...
}, |
added brother... Thank you for responding... |
Thank you So Much.!!! It's works |
But this option does not solve the problem, it only removes the warning at the time of compilation or execution of the application. |
Hello @johancollazosdeveloper, You can import Highcharts using ESModules, see: https://www.highcharts.com/docs/getting-started/installation-with-esm tl;dr: instead of importing Highcharts & modules this way: import Highcharts from 'highcharts';
import A11yModule from 'highcharts/modules/accessibility';
A11yModule(Highcharts); you can import them using import Highcharts from 'highcharts/es-modules/masters/highcharts.src';
import 'highcharts/es-modules/masters/modules/accessibility.src'; or import only the classes you need, e.g.: import Chart from 'highcharts/es-modules/Core/Chart/Chart.js';
import LineSeries from 'highcharts/es-modules/Series/Line/LineSeries.js'; |
@johancollazosdeveloper, a proper and complete solution is documented on #163 (comment) (ddragula's suggestion will not lazy-load Highcharts, so your app Initial Total size will be much bigger than it needs to be, leading to poor LCP, possibly leading to poorer Google ranking) |
depends on 'highcharts'. CommonJS or AMD dependencies can cause optimization bailouts getting this is in angular 10
The text was updated successfully, but these errors were encountered: