Leaflet - like many JavaScript libraries today - has detection logic in it that dynamically determines the environment the script is in and loads the guts of library code
(1) as a
global variable,
(2) as an
AMD module,
(3) as a
CommonJS module or
(4) as a
ES6 module. You have to unminify the Leaflet library to see this code and since it is machine generated as part of the build process it can be very difficult to read and understand:
! function(t, i) {
"object" == typeof exports && "undefined" != typeof module ? i(exports) : "function" == typeof define && define.amd ? define(["exports"], i) : i(t.L = {})
}(this, function(t) {
// .... lots of code ...
});
Since QuickBase uses
requirejs to load
AMD modules onto its pages, Leaflet will detect this condition and load as an
AMD module if properly configured.
require.config({
paths: {
"leaflet": "https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.4/leaflet";
}
});
require(['leaflet'], function(L) {
console.dir(L);
});