MCPcopy
hub / github.com/webpack/webpack / wrapDynamicImport

Function wrapDynamicImport

test/bun-preload.js:30–44  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

28const toNamespace = (mod) =>
29 nodeVm.Module && mod instanceof nodeVm.Module ? mod.namespace : mod;
30const wrapDynamicImport = (options) => {
31 if (!options || typeof options.importModuleDynamically !== "function") {
32 return options;
33 }
34 const original = options.importModuleDynamically;
35 return {
36 ...options,
37 importModuleDynamically(...args) {
38 const result = original.apply(this, args);
39 return result && typeof result.then === "function"
40 ? result.then(toNamespace)
41 : toNamespace(result);
42 }
43 };
44};
45const originalCompileFunction = nodeVm.compileFunction;
46nodeVm.compileFunction = function compileFunction(code, params, options) {
47 return originalCompileFunction.call(

Callers 2

bun-preload.jsFile · 0.85
constructorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected