Skip to content

Commit 5c50184

Browse files
committed
doc: spell out condition restrictions
PR-URL: nodejs#55187
1 parent a67cb6c commit 5c50184

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

doc/api/packages.md

+14
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,20 @@ exports, while resolving the existing `"node"`, `"node-addons"`, `"default"`,
689689

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

692+
Typical conditions should only contain alphanumerical characters,
693+
using ":" or "=" as separators if necessary. Anything else may run
694+
into compability issues outside of node.
695+
696+
In node, conditions can be almost any string, including multi-byte characters and whitespace. There's only a few restrictions:
697+
698+
1. They must contain at least one character.
699+
2. They cannot start with "." since they may appear in places that also
700+
allow relative paths.
701+
3. They cannot contain "," since they may be parsed as a comma-separated
702+
list by some CLI tools.
703+
4. They cannot be numeric property keys like "10" since that can have
704+
unexpected effects on property ordering.
705+
692706
### Community Conditions Definitions
693707

694708
Condition strings other than the `"import"`, `"require"`, `"node"`,

0 commit comments

Comments
 (0)