I would like to use mathjs in my Ionic react project.
I've installed the library by using npm install mathjs.
Now I'm trying to use the library with the following code from the mathjs website:
import { sqrt } from 'mathjs'
console.log(sqrt(-4).toString())
As well as:
import { create, all } from 'mathjs'
const config = { }
const math = create(all, config)
console.log(math.sqrt(-4).toString())
But I'm always getting an error:
Fraction.js:9 Uncaught TypeError: Object.defineProperty called on non-object
at Function.defineProperty (<anonymous>)
at createFractionClass.isClass (Fraction.js:9:1)
at assertAndCreate (factory.js:35:1)
at resolver (import.js:243:1)
at Object.get [as Fraction] (object.js:211:1)
at import.js:240:1
at Array.forEach (<anonymous>)
at resolver (import.js:228:1)
at Object.get [as typed] (object.js:211:1)
at import.js:240:1
How can I solve it? Thanks!