Skip to content
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

Angular 10 build warning #1003

Open
spock123 opened this issue Jun 28, 2020 · 19 comments
Open

Angular 10 build warning #1003

spock123 opened this issue Jun 28, 2020 · 19 comments

Comments

@spock123
Copy link

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

@smlombardi
Copy link

smlombardi commented Jun 29, 2020

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

@codekrafter
Copy link

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.

@jziggas
Copy link
Contributor

jziggas commented Jul 1, 2020

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;

@centigradeclemensP
Copy link

centigradeclemensP commented Jul 9, 2020

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

@prsevero
Copy link

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.

@smlombardi
Copy link

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

@2ndClemens
Copy link

Angular Material CDK doesn't support drag and drop in a grid with wrapping, if you need that, ng2-dragula is still a valid choice.
angular/components#13372

@Gillardo
Copy link

Will this be done in the next version?

@Gillardo
Copy link

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

@jziggas
Copy link
Contributor

jziggas commented Sep 14, 2020

Fixed in 1008, awaiting version bump and release.

Edit: Shoutout to @centigradeclemensP for providing the fix.

@jziggas
Copy link
Contributor

jziggas commented Sep 15, 2020

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

@jziggas
Copy link
Contributor

jziggas commented Sep 16, 2020

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.

@Peter-Zakharevich
Copy link

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

@nealpatil01
Copy link

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

@sampath13
Copy link

Hello Maintainer,

Is the fix released ?

@ulrichmueller
Copy link

Hello.

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

Best regards.

@Xaivteev
Copy link

Seconding ulrichmueller's request.
@jziggas

@m-wheeler
Copy link

I want this too

@rg1220
Copy link

rg1220 commented Sep 7, 2022

@cormacrelf, @valorkin, @jziggas - Just curious if this will ever get published to NPM?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests