// packages/package-with-exports/package.json
{
"name": "package-with-exports",
"version": "1.0.0",
"exports": {
".": "./main.js",
"./sub/other": "./other.js"
}
}
// Example 1
// Expected: packages/package-with-exports/main.js
// Actual: packages/package-with-exports/index.js
require("package-with-exports");
// Example 2
// Expected: packages/package-with-exports/other.js
// Actual: throws error
require("package-with-exports/sub/other");
Describe the bug
See:
Node ^12.7.0 with the
--experimental-modulesflag and Node ^13.0.0 without the flag resolves modules differently than Yarn@2.0.0-rc19 with PNPTo Reproduce
See this project:
https://github.com/sparebytes/yarn2-pnp-exports-example
Environment