The node-resolve is dependent on resolve which in turn, does not support native ESM packages (type=module in package.json) see browserify/resolve#222
As a result, a well-known consumer of node-resolve, the Mr. Dodds' mdx-bundler doesn't properly compile ESM packages. For example, it would compile matcher which is ESM only because it has minimalistic "exports": "./index.js", https://github.com/sindresorhus/matcher/blob/main/package.json#L14 — any other value, including differently-named JS file, will fail in MDX bundler.
If you want to recreate the issue, just tweak the unit test to resolve package.json key exports pointing to anything else than index.js, and of course, make it type: module and without main.
The
node-resolveis dependent onresolvewhich in turn, does not support native ESM packages (type=modulein package.json) see browserify/resolve#222As a result, a well-known consumer of
node-resolve, the Mr. Dodds'mdx-bundlerdoesn't properly compile ESM packages. For example, it would compilematcherwhich is ESM only because it has minimalistic"exports": "./index.js",https://github.com/sindresorhus/matcher/blob/main/package.json#L14 — any other value, including differently-named JS file, will fail in MDX bundler.If you want to recreate the issue, just tweak the unit test to resolve
package.jsonkeyexportspointing to anything else thanindex.js, and of course, make ittype: moduleand withoutmain.