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

disable loader on node 20 #27

Closed rochdev closed 1 year ago

rochdev commented 1 year ago

Node 20 made significant changes to ESM loaders which are incompatible with this library, resulting in a crash. This will require an investigation and potential rewrite, but in the meantime it should not crash, so instead support for Node 20 was removed. This will cause the loader hook to not run, which will break the functionality but avoid the crash.

Since I had to move the code to a CJS file in order to add a condition based on the Node version, I also removed getSource and getFormat from versions where they are deprecated to avoid the warning.