Skip to content

Commit e15f779

Browse files
jkremsaduh95
authored andcommittedOct 19, 2024
doc: spell out condition restrictions
PR-URL: #55187 Reviewed-By: Matteo Collina <[email protected]>
1 parent 69ee56a commit e15f779

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

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

758+
Typical conditions should only contain alphanumerical characters,
759+
using ":", "-", or "=" as separators if necessary. Anything else may run
760+
into compability issues outside of node.
761+
762+
In node, conditions have very few restrictions, but specifically these include:
763+
764+
1. They must contain at least one character.
765+
2. They cannot start with "." since they may appear in places that also
766+
allow relative paths.
767+
3. They cannot contain "," since they may be parsed as a comma-separated
768+
list by some CLI tools.
769+
4. They cannot be integer property keys like "10" since that can have
770+
unexpected effects on property key ordering for JS objects.
771+
758772
### Community Conditions Definitions
759773

760774
Condition strings other than the `"import"`, `"require"`, `"node"`, `"module-sync"`,

0 commit comments

Comments
 (0)