patternfly / patternfly/patternfly-react

Packages do not specify an `exports` field

Open
#10,832 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Breaking change :boom: Pinned
Dominant language
TypeScript
Stars
862
Forks
392
Avg merge
4d 8h
Merged PRs (30d)
9

Description

Packages in the workspaces should set the exports field in the package.json file. As Node.JS doesn't read the module field, the ESM output may be skipped if the exports field is not added.

Specifying the exports field also prevents modules that are written in ESM from being interpreted as CommmonJS. For example, it is currently possible to make the following import:

import foo from "@patternfly/react-drag-drop/dist/esm/next/components/DragDrop/DragButton"

Since there is no type specified this file would be considered CommonJS, even though the source is actually written in ESM.

The exports field supplants the main and module fields, which should be removed when the exports field is introduced. This would be considered a breaking change.

This is part of a series of issues resulting from publication linting introduced under #10764

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the workspace package.json files and the publication linting context from #10764. Add exports entries for the packages, remove the superseded main and module fields where applicable, and verify that the documented ESM import is resolved correctly by Node.js.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
build-system, release
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.