blob: e7e1e0cce2022320d129335461fec9da17bc378b (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 | export const loadDependency = {
  async fromWindow(modulePath) {
    globalThis.window = {};
    await import(modulePath);
    const exports = globalThis.window;
    delete globalThis.window;
    return exports;
  },
  async fromModuleExports(modulePath) {
    globalThis.exports = {};
    globalThis.module = {exports: globalThis.exports};
    await import(modulePath);
    const exports = globalThis.exports;
    delete globalThis.module;
    delete globalThis.exports;
    return exports;
  },
};
 |