Magento 2 中的 Requirejs 给了我 undefined 而不是我的库

Requirejs in Magento 2 gives me undefined instead of my library

我在 Magento 2 中使用 Requirejs 加载 Babylonjs(3.3 版)。但是在我的回调中,requirejs 在我的 BABYLON 对象中给了我一个 undefined。

我曾尝试使用 requirejs-config.js 来替换名称,但没有成功。

require(['My_Module/js/babylon','My_Module/js/babylon.gui.min'], function(BABYLON, GUI) {
    console.log(BABYLON); // undefined
    new BABYLON.Color3(0,0,0,0) // TypeError BABYLON.Color3 is not a constructor
});

我要加载的文件在 My/Module/view/frontend/web/js 中。并命名为 babylon.jsbabylon.gui.min.js

我希望回调中的 BABYLON 变量是 BABYLON 对象,因为我会在 CommonJS 环境中导入它。

原来库将自己定义为 babylonjs。不像 My_Module/js/babylonjs.