I need moduleA and moduleB to have a different context. moduleA and moduleB are exisisting javascript libraries which both request a 'context' module.
Is it possible when we require moduleA or moduleB to pass in a different version of context Or another way to differentiate
// EXISTING libraries, can not alter:
// moduleA uses 'context'
define(["context"], function (context) {});
// moduleB also uses 'context'
define(["context"], function (context) {});
// MY code:
// ❌. Can define a 'global' context here, but it will be the same for both.
define("context", () => {});
// ✅ Possible to let moduleA require a different context then module B ??
// On requiring module A, or a different way
requirejs(["moduleA"],()=>{
// console.log('run when moduleA and thus context are loaded
});
requirejs(["moduleB"],()=>{
// console.log('run when moduleB and thus context are loaded
});