requirejs loads a lib successfully, but object is not accessible
Author: llagerlofCreated Jul 27, 2021Updated Sep 22, 2024
I am using requirejs to load some libs, and works perfectly. E.g.:
requirejs(["js/vendor/jquery"], function ($) {
console.log('jquery.js loaded successfully. I can use the "$" object everywhere.')
});But when I try to load math.js (from mathjs.org) like:
requirejs(["js/vendor/math"], function (math) {
console.log('math.js loaded successfully. But I CAN'T use the "math" object everywhere.');
});The object "math" is not defined when I try to use it. Does anyone know why?
(I am using the minified version of https://cdnjs.com/libraries/mathjs)
I already tried to load both, like:
requirejs(["js/vendor/jquery", "js/vendor/math"], function ($, math) {
});But only the "$" object is available after that.
The most strange, if I load the math.js using the
Source: requirejs/requirejs