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
72 stars 27 forks source link

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

Closed timfish closed 4 months ago

timfish commented 5 months 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.