Commonjs or amd dependencies can cause optimization bailouts.

Our state of the art Gantt chart



Do you see the same warning when running some of our demos? If not, we would need a simplest possible showcase that we can run, investigate and debug.

Post please also your Bryntum Gantt version and Angular version you're running.


No, in the demo I didn't see this error.

Gantt Version: 4.0.8
Angular: 11

tions": {
     "allowedCommonJsDependencies": [
        "lodash"    
]

What do we need to replace the dependencies instead of lodash?


You should add the package file there:

"allowedCommonJsDependencies": [
  "lodash",
  "bryntum-gantt/gantt.lite.umd.js"
]



  • Post Options:
  • Link

Posted 1 July 2020, 1:58 am EST

Hi,

I have upgraded the Angular project to the Angular versions 10 and after upgrading it gives the following warnings.

WARNING in abc.module.ts depends on @grapecity/wijmo.angular2.grid. CommonJS or AMD dependencies can cause optimization bailouts.

WARNING in abc.module.ts depends on @grapecity/wijmo.angular2.grid.filter. CommonJS or AMD dependencies can cause optimization bailouts.

WARNING in abc.module.ts depends on @grapecity/wijmo.angular2.input. CommonJS or AMD dependencies can cause optimization bailouts.

Need help with this, how can I fix those warnings.

(Original URL)

After upgrading to Angular 10 we get these warnings when doing builds:

WARNING in /Users/lrj/project/mother-qorder/admin/node_modules/ng2-dragula/__ivy_ngcc__/dist/fesm2015/ng2-dragula.js depends on dragula. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Comments (18)

+9

With regards to Angular 10 compatibility there is also this error which can prevent builds from passing:

node_modules/ng2-dragula/dist/components/dragula.module.d.ts:3:23 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).

3     static forRoot(): ModuleWithProviders;

+3

Month later and no reply?? Is this being done or has this package been abandoned?

+3

Ditched it and moved to Angular Material’s drag and drop. Much simpler to use.

+3

there are more warnings:

WARNING in .../node_modules/ng2-dragula/__ivy_ngcc__/dist/fesm2015/ng2-dragula.js depends on dragula. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in.../node_modules/dragula/dragula.js depends on contra/emitter. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in .../node_modules/dragula/dragula.js depends on crossvent. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

+2

Hello Maintainer,

Is the fix released ?

+2

Just a hotfix, until we don’t get an update on this.

You can add the flag "skipLibCheck": true to your tsconfig.app.json, under compilerOptions.

+1

Sad to say that - I replaced ng2-dragula with ngx-bootstrap because of this warning.

Seconding ulrichmueller’s request. @jziggas

Hello.

Is there any date set for a new npm package for newer Angular Versions? Thanks for the great work anyway. 😃

Best regards.

Hi everyone! Сould you please tell when we can expect a new release version with a fix for this issue?

I tried to upgrade the demo’s package.json but a slew of errors from ng-packagr occurred and I gave up. As well as what I think are red herrings like linting and unit test errors because it doesn’t seem like those were kept up to date for the demo. I don’t think I’m familiar enough with yarn and ng-packagr to fix the rest.

I think the version of Angular in the demo folder needs to be updated in order for the build to pass.

Will this be done in the next version?

this could be fixed by changing it to static forRoot(): ModuleWithProviders<any>;

This is because as of Angular 10.0, Angular will output a warning for all CommonJS dependencies, as they impact the tree-shaking of applications (this link explains it: https://web.dev/commonjs-larger-bundles/).

To fix this warning all packages referenced in the warnings (dragula, contra/emitter and crossvent) need to be released as es2015 modules.