Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: spell out condition restrictions #55187

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions doc/api/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,21 @@ exports, while resolving the existing `"node"`, `"node-addons"`, `"default"`,

Any number of custom conditions can be set with repeat flags.

Typical conditions should only contain alphanumerical characters,
using ":" or "=" as separators if necessary. Anything else may run
into compability issues outside of node.

In node, conditions can be almost any string, including multi-byte characters and whitespace.
There's only a few restrictions:

1. They must contain at least one character.
2. They cannot start with "." since they may appear in places that also
allow relative paths.
3. They cannot contain "," since they may be parsed as a comma-separated
list by some CLI tools.
4. They cannot be numeric property keys like "10" since that can have
unexpected effects on property ordering.

### Community Conditions Definitions

Condition strings other than the `"import"`, `"require"`, `"node"`,
Expand Down
Loading