nodejs / import-in-the-middle

Like `require-in-the-middle`, but for ESM import
https://www.npmjs.com/package/import-in-the-middle
Apache License 2.0
60 stars 22 forks source link

handle then() exports #6

Open bmeck opened 2 years ago

bmeck commented 2 years ago

Expected Behavior

works with modules that export a then() method

export function then() {}

Actual Behavior

crash

Proposed Fix

use indirection like a data URL to load the module namespace rather than directly when using import() : https://github.com/DataDog/import-in-the-middle/blob/main/hook.mjs#L40