Trying to import a package that has entries for CommonJS and ESM fails to evaluate the exports field. An easy regression is to evaluate this against @eslint/eslintrc (which was where I noticed the behavior):
The output is /<project>/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/universal.js but should be /<project>/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs
My suggestion is to terminate and hit the original implementation early if the resolved path is in node_modules.
Trying to import a package that has entries for CommonJS and ESM fails to evaluate the
exports
field. An easy regression is to evaluate this against@eslint/eslintrc
(which was where I noticed the behavior):The output is
/<project>/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/universal.js
but should be/<project>/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs
My suggestion is to terminate and hit the original implementation early if the resolved path is in node_modules.