big.js is a CommonJS dependency
envgap__MikeMcl__big.js-170
01 / FAILURE SIGNATURE
As reported upstream
5. Get the following error:
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
8655bdfe8940a904ab548240324bb2e297c463bc- Manifest
package.json- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
MikeMcl/big.js #170 · read the original issue
Steps to reproduce:
1. Use npm to install big.js in an Angular 10+ library.
2. Import big.js into a file in the Angular library.
In this case `import Big from 'big.js';`, `import { Big } from 'big.js';` and `import * as Big from 'big.js';` all behave the same.
3. Build the library.
4. Install the library in an Angular 10+ project and build that project.
5. Get the following error:
`WARNING in <PROJECT_DIRECTORY>\node_modules\<PARENT_PACKAGE>\__ivy_ngcc__\<PACKAGE_NAME>\fesm2015\<PROJECT_NAME>.js depends on 'big.js'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies`
It seems that the big.js package provided by npm doesn't properly export its ES Module. Upon looking into the package, I do see big.mjs, but any attempt at doing something like `import Big from 'big.js\big.mjs';` causes a compilation failure.
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]