Added AMD loader initialization as separate entry, autoload everything

This commit is contained in:
koloml committed 2025-04-06 15:13:31 +04:00
1 parent 7cf2730402
commit 966100d606
3 files changed
+53

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import { amdLite } from "amd-lite";
const originalDefine = amdLite.define;
amdLite.define = (name, dependencies, originalCallback) => {
return originalDefine(name, dependencies, function () {
const callbackResult = originalCallback(...arguments);
// Workaround for the entry script not returning anything causing AMD-Lite to send warning about modules not
// being loaded/not existing.
return typeof callbackResult !== 'undefined' ? callbackResult : {};
})
}
amdLite.init({
publicScope: window
});
// We don't have anything asynchronous, so it's safe to execute everything on the next frame.
requestAnimationFrame(() => {
amdLite.resolveDependencies(Object.keys(amdLite.waitingModules))
});