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
52 stars 20 forks source link

fix: CJS `require('.')` resolution #108

Closed timfish closed 6 days ago

timfish commented 2 weeks ago

Closes #116 and closes #97

While trying to create a minimal reproduction for #106, I found that the issue was caused by the following CommonJs in @prisma/client:

module.exports = { ...require('.') }

require('.') was getting resolved to {cwd}/index.js whereas it should be resolving to ./, ie. the index file in the same directory as the current file ./index.js.