Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.7.0
-
None
Description
Math.js is supposed to work on any ES6 compatible JavaScript engine, but versions newer than 9.4.3 does not work with Qt.
This code works fine with Math.js 9.4.3
import QtQuick import "math_943.js" as MathJs Window { width: 640 height: 480 visible: true title: math.version }
but with version 9.4.4 you get this:
qrc:/qt/qml/mjs/math_944.js:33: TypeError: Type error qrc:/qt/qml/mjs/Main.qml:7: ReferenceError: math is not defined
The cause of the error seems to be this functions (as reported here: https://github.com/josdejong/mathjs/issues/2346#issuecomment-960484438)
function(e,t,r) { var n=r(20),i=r(23),a=r(73); e.exports=n? function(e,t,r) { return i.f(e,t,a(1,r)) // <--------------- Type error } : function(e,t,r) { return e[t]=r,e } }
The github discussion linked above have some additional details.
With old Qt versions (like 6.2) you also had to replace all occurrences of
"use strict";
with
;"use strict";
to get math.js 9.4.3 working but that seems to have been fixed
The Math.js files (minified) are available here:
Math.js 9.4.3: https://unpkg.com/mathjs@9.4.3/lib/browser/math.js
Math.js 9.4.4: https://unpkg.com/mathjs@9.4.4/lib/browser/math.js
Attachments
Issue Links
- depends on
-
QTBUG-126813 Type error thrown when assigning to properties of a WeakMap
- Closed