Open Lms24 opened 1 month ago
This is likely a duplicate of https://github.com/nodejs/import-in-the-middle/issues/139.
I'm gonna leave this open from my end until we can confirm that #140 fixes this issue as well. If it does, sorry for the duplicate! If you wanna close this before, please feel free!
This is not a duplicate of #139 because my current PR doesn't fix this.
Oh wow, so this issue is caused by the fact that we are finding a duplicate export named or
. Duplicate named exports are usually not exported up through to the root of the module but they are in this case because they come from the same source file.
A simpler reproduction:
a.mjs
export const val = 1;
b.mjs
export * from './a.mjs';
c.mjs
export * from './a.mjs';
export * from './b.mjs';
When run in Node, c.mjs
has a single export named val
.
When running through import-in-the-middle
there is no export.
We are not currently checking if duplicate named exports are from the same source file.
Expected Behavior
Using
import-in-the-middle
works with imports fromdrizzle-orm
as with other NPM packagesActual Behavior
Registering the
import-in-the-middle
hook causes certain top-level exports from thedrizzle-orm
package to be missing.This was originally reported as a bug in our Sentry JS SDK repo and I tracked it down to registering the IITM hook as the only thing needed to reproduce the error.
Steps to Reproduce the Problem
I created a minimal reproduction example in this repo: https://github.com/Lms24/iitm-bug-drizzle-or
npm install
node index.js
:drizzle-orm
console lognode --import instrument.mjs index.js
drizzle-orm
console log (=> 27 exports missing)drizzle.or()
)Specifications
import-in-the-middle@1.9.0