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

add Node.js v20 support #28

Closed bengl closed 1 year ago

bengl commented 1 year ago

Since Node.js v20 moves loaders to a separate thread, we can no longer depend on loading the modules in the loader to get the exports. This is needed to add our mutable proxy. For Node.js 20, exports are now retrieved via parsing.

To reduce startup overhead on older versions of Node.js, the previous method of getting exports is used, avoiding loading and using parsers.