angular-application-insights icon indicating copy to clipboard operation
angular-application-insights copied to clipboard

warnings in Angular 10 upgrade - CommonJS or AMD dependencies can cause optimization bailouts

Open apranzetti opened this issue 5 years ago • 2 comments

Describe the bug Upgrading to the latest version of angular and using '@markpieszak/ng-application-insights' will cause console warnings

To Reproduce Steps to reproduce the behavior:

Install version 10 of Angular CLI Follow instructions from here https://docs.amplify.aws/start/getting-started/installation/q/integration/angular build the app

Temporarily solution Add to angular.json : "allowedCommonJsDependencies": [ "@markpieszak/ng-application-insights" ] to avoid console error.

Expected behavior NO warnings.

Console snippet

WARNING in *** depends on '@markpieszak/ng-application-insights'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

apranzetti avatar Oct 02 '20 10:10 apranzetti

I believe this may be due to the fact that we're using the underlying microsoft/application-insights-js package. I'm looking but I'm not sure if the v2 version even fixes this issue there.

MarkPieszak avatar Apr 19 '21 17:04 MarkPieszak

According to this comment, v2 uses ES6 modules https://github.com/microsoft/ApplicationInsights-JS/issues/301#issuecomment-442542939

Astrophizz avatar Apr 20 '21 05:04 Astrophizz