Skip to content

Support of package.json subpath exports #403

@andrey-ivlev-qs

Description

@andrey-ivlev-qs

More and more packages moving to ESM format and start using package subpath exports like this (example from lingui lib)

{
  "name": "@lingui/cli",
  "exports": {
    "./api": {
      "types": "./dist/api/index.d.ts",
      "default": "./dist/api/index.js"
    },
    "./api/extractors/typescript": {
      "types": "./dist/api/extractors/typescript.d.ts",
      "default": "./dist/api/extractors/typescript.js"
    }
  },
}

And FS Monkey is unable to resolve require calls like require('@lingui/cli/api').

Specification is stable since node 14

v20 docs: https://nodejs.org/docs/latest-v20.x/api/packages.html#subpath-exports
see also #378 (same issue with partial solution)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions