Skip to content

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

Merged
timfish merged 4 commits intonodejs:mainfrom
timfish:fix/cjs-root-resolution
Jul 1, 2024
Merged

fix: CJS require('.') resolution#108
timfish merged 4 commits intonodejs:mainfrom
timfish:fix/cjs-root-resolution

Conversation

@timfish
Copy link
Copy Markdown
Contributor

@timfish timfish commented Jun 18, 2024

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.

Copy link
Copy Markdown
Contributor

@jsumners-nr jsumners-nr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@timfish timfish merged commit 29c77b5 into nodejs:main Jul 1, 2024
@timfish timfish deleted the fix/cjs-root-resolution branch July 1, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants