Skip to content

Commit 85d8eb3

Browse files
jkremsmarco-ippolito
authored andcommitted
doc: spell out condition restrictions
PR-URL: #55187 Reviewed-By: Matteo Collina <[email protected]>
1 parent 3fcca16 commit 85d8eb3

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
@@ -715,6 +715,20 @@ exports, while resolving the existing `"node"`, `"node-addons"`, `"default"`,
715715

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

718+
Typical conditions should only contain alphanumerical characters,
719+
using ":", "-", or "=" as separators if necessary. Anything else may run
720+
into compability issues outside of node.
721+
722+
In node, conditions have very few restrictions, but specifically these include:
723+
724+
1. They must contain at least one character.
725+
2. They cannot start with "." since they may appear in places that also
726+
allow relative paths.
727+
3. They cannot contain "," since they may be parsed as a comma-separated
728+
list by some CLI tools.
729+
4. They cannot be integer property keys like "10" since that can have
730+
unexpected effects on property key ordering for JS objects.
731+
718732
### Community Conditions Definitions
719733

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

0 commit comments

Comments
 (0)