swashcap / scino

Format numbers in scientific notation.
MIT License
0 stars 0 forks source link

TypeError: Decimal is not a constructor #1

Open foundryspatial-duncan opened 3 years ago

foundryspatial-duncan commented 3 years ago

I just installed this package to use it for number formatting in a chart, but I get this fatal error when I try to use it. (even scino(12345) throws this error)

TypeError: Decimal is not a constructor

Some info from yarn why decimal.js shows it's version 7.5.1:

=> Found "decimal.js@7.5.1"
info Reasons this module exists
   - "scino" depends on it
   - Hoisted from "scino#decimal.js"

And the package I'm using is scino@1.0.2

foundryspatial-duncan commented 3 years ago

I think it's caused by the way webpack is resolving dependencies. (see: https://github.com/webpack/webpack/issues/4742 for related info) It expects there to be a .default where scino importing the default export from decimal.js ... I dunno what the solution would be, short of providing an ES module version of scino. :shrug: