Skip to content

Commit b223c49

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

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

doc/api/packages.md

+15
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,21 @@ 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.
697+
There's only a few restrictions:
698+
699+
1. They must contain at least one character.
700+
2. They cannot start with "." since they may appear in places that also
701+
allow relative paths.
702+
3. They cannot contain "," since they may be parsed as a comma-separated
703+
list by some CLI tools.
704+
4. They cannot be numeric property keys like "10" since that can have
705+
unexpected effects on property ordering.
706+
692707
### Community Conditions Definitions
693708

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

0 commit comments

Comments
 (0)