angular-cesium icon indicating copy to clipboard operation
angular-cesium copied to clipboard

Remove warning from angular 10 compilation

Open Crocsx opened this issue 5 years ago • 2 comments

In Angular 10, when compiling the project those warning appears :

WARNING in C:\Users\****\Documents\Repository\****\node_modules\angular-cesium\__ivy_ngcc__\fesm2015\angular-cesium.js depends on 'geodesy'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in C:\Users\****\Documents\Repository\****\node_modules\angular-cesium\__ivy_ngcc__\fesm2015\angular-cesium.js depends on 'util'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

I believe this could be avoided by changing library/way of import

Crocsx avatar Aug 23 '20 13:08 Crocsx

I agree, the link in the warnings shows you how to hide the warnings(https://angular.io/guide/build#configuring-commonjs-dependencies).

It recommends using a "ECMAScript modules" instead of the commonjs not sure what complications are with updating the following https://github.com/articodeltd/angular-cesium/blob/master/projects/angular-cesium/tsconfig.schematics.json#L9

 "module": "commonjs",

to

  "module": "es2020",

It would be nice to optimize this section of the code.

AshitakaLax avatar Dec 10 '20 16:12 AshitakaLax

actually looking at it a little more it looks like there are dependencies on 'geodesy' and 'util'. Which I was slow to realize was the cause of it.

here is the snippet to add if you want to disable the build warnings in the angular.json options

      "options": {
        "allowedCommonJsDependencies":[
          "geodesy",
          "util"
        ]
      }

AshitakaLax avatar Dec 10 '20 16:12 AshitakaLax