mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
### What does this PR do? Fixes #24387 ### How did you verify your code works? --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Marko Vejnovic <marko@bun.com>
13 lines
380 B
JavaScript
13 lines
380 B
JavaScript
// @bun
|
|
var { require } = import.meta;
|
|
const entrypointPath = "./p.js";
|
|
let listener;
|
|
try {
|
|
listener = await require(entrypointPath);
|
|
} catch (e) {
|
|
console.log(e.message.replace(require.resolve(entrypointPath), "<the module>"));
|
|
listener = await import(entrypointPath);
|
|
}
|
|
for (let i = 0; i < 5; i++) if (listener.default) listener = listener.default;
|
|
console.log(listener);
|