Skip to content

[Case Study] Exports Support #650

@sparebytes

Description

@sparebytes
  • I'd be willing to implement a fix

Describe the bug

See:

Node ^12.7.0 with the --experimental-modules flag and Node ^13.0.0 without the flag resolves modules differently than Yarn@2.0.0-rc19 with PNP

To Reproduce

See this project:
https://github.com/sparebytes/yarn2-pnp-exports-example

// 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");

Environment

  • OS: Windows
  • Node version ^12.7.0
  • Yarn version 2.0.0-rc19

Metadata

Metadata

Assignees

No one assigned

    Labels

    case studyPackage compatibility reporthelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions