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 module depends on 'bignumber.js'. CommonJS or AMD dependencies can cause optimization bailouts. #278

Open
jbakoc1 opened this issue Nov 10, 2020 · 8 comments

Comments

@jbakoc1
Copy link

jbakoc1 commented Nov 10, 2020

After upgrading to Angular version 10 I get the message depends on 'bignumber.js'. CommonJS or AMD dependencies can cause optimization bailouts.
Are you going to publishing an ES module?

@MikeMcl
Copy link
Owner

MikeMcl commented Nov 10, 2020

It's the bignumber.mjs file.

See the package.json:

"module": "bignumber.mjs",

@phip1611
Copy link

phip1611 commented Mar 1, 2021

Did anyone found a solution how angular build finds the *.mjs file? I have the same problem too.

@jbakoc1
Copy link
Author

jbakoc1 commented Mar 1, 2021

@phip1611 The way I found was to rename the bignumber.mjs -> bignumber.js
There is probably a better way that I don't know 😉

@abcfy2
Copy link

abcfy2 commented Mar 19, 2021

Same issue here, any update?

@Amir-Afkhami
Copy link

This is because in Angular you must add this for each CommonJS Dependency:
"options": { "allowedCommonJsDependencies": ["bignumber.js"] }

@jbakoc1
Copy link
Author

jbakoc1 commented Apr 9, 2021

This is because in Angular you must add this for each CommonJS Dependency:
"options": { "allowedCommonJsDependencies": ["bignumber.js"] }

This option tells the compiler to ignore the warning. Not fixing the issue.

@gabrielbiga
Copy link

gabrielbiga commented Apr 14, 2021

I'm not 100% sure why, but importing like that seems to solve the warning:

import { BigNumber } from 'bignumber.js/bignumber';

webpack-bundle-analyzer:
bignumbermjs

@jbakoc1
Copy link
Author

jbakoc1 commented Apr 14, 2021

I confirm this. I changed my imports. Thanks @gabrielbiga

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

6 participants