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

Import Decimal from decimal.js rather than decimal.mjs #3165

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

nikolas
Copy link

@nikolas nikolas commented Feb 24, 2024

The decimal.js package provides the decimal.js as well as decimal.mjs files. See: https://github.com/MikeMcl/decimal.js

In certain webpack configurations, the decimal.mjs file is loaded, causing the error:

Uncaught TypeError: decimal_js__WEBPACK_IMPORTED_MODULE_0__.default.clone is not a function
    createBigNumberClass BigNumber.js:12
    assertAndCreate factory.js:35

When we are more specific with this import, this error is resolved.

The `decimal.js` package provides the decimal.js as well as decimal.mjs files. See: https://github.com/MikeMcl/decimal.js

In certain webpack configurations, the decimal.mjs file is loaded, causing the error:
```
Uncaught TypeError: decimal_js__WEBPACK_IMPORTED_MODULE_0__.default.clone is not a function
    createBigNumberClass BigNumber.js:12
    assertAndCreate factory.js:35
```

When we are more specific with this import, this error is resolved.
@josdejong
Copy link
Owner

Thanks for your PR Nikolas.

In general, I would like to move code to ESM, and not to CommonJS/UMD, and use the regular import instead of pointing to a specific file.

Can we figure out what is going wrong in your setup? Maybe we can come up with an other solution. How can I reproduce this issue?

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

Successfully merging this pull request may close these issues.

2 participants