Skip to content

Adjust the exports field in package.json to avoid using invalid subpaths #2523

@algoORgoal

Description

@algoORgoal

Scope

Adds a new behavior

Compatibility

  • This is a breaking change

Feature description

Is your feature request related to a problem? Please describe.
I'm always frustrated when I see warnings about invalid package.json configuration due to the use of ".." in the exports field. This causes compatibility issues with some bundlers and package managers, and makes it harder to ensure smooth project setup.

Describe the solution you'd like
I would like the exports field in package.json to use only valid subpaths, avoiding ".." in the path, so that the warning is eliminated and compatibility is improved.

Describe alternatives you've considered

  • Ignoring the warning, but this could lead to future compatibility issues.
  • Manually patching the package after installation, but this is not maintainable.

Are you able to assist bring the feature to reality?
yes, I can contirbute to the repo.

Additional context

  • I set unstable_enablePackageExports to true to enable package exports optoin. It was necessary since some moduels need to pick up different files based on the environment(react-naitve or browser).
  • This issue was observed in a React Native/Expo project, but it may affect other environments as well. The warning message is:
 WARN  The package /Users/mac/Projects/study-up-frontend/node_modules/msw/native contains an invalid package.json configuration. Consider raising this issue with the package maintainer(s).
Reason: The target for "." defined in "exports" is "./../lib/native/index.mjs", however this value is an invalid subpath or subpath pattern because it includes "..". Falling back to file-based resolution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions