@@ -537,6 +537,11 @@ Node.js implements the following conditions:
537537*  ` "node" `  - matches for any Node.js environment. Can be a CommonJS or ES
538538   module file. _ This condition should always come after ` "import" `  or
539539   ` "require" ` ._ 
540+ *  ` "node-addons" `  - similar to ` "node" `  and matches for any Node.js environment.
541+    This condition can be used to provide an entry point which uses native C++
542+    addons as opposed to an entry point which is more universal and doesn't rely
543+    on native addons. This condition can be disabled via the
544+    [ ` --no-addons `  flag] [ ] .
540545*  ` "default" `  - the generic fallback that always matches. Can be a CommonJS
541546   or ES module file. _ This condition should always come last._ 
542547
@@ -615,17 +620,23 @@ node --conditions=development main.js
615620``` 
616621
617622which would then resolve the ` "development" `  condition in package imports and
618- exports, while resolving the existing ` "node" ` , ` "default " ` , ` "import " ` , and 
619- ` "require" `  conditions as appropriate.
623+ exports, while resolving the existing ` "node" ` , ` "node-addons " ` , ` "default " ` ,
624+ ` "import"  ` , and  ` " require"`  conditions as appropriate.
620625
621626Any number of custom conditions can be set with repeat flags.
622627
623628### Conditions Definitions  
624629
625- The ` "import" ` , ` "require" ` , ` "node" `  and  ` "default " `  conditions are defined 
626- and implemented in Node.js core,
630+ The ` "import" `   , ` "require" `   , ` "node" `  ,  ` "node-addons " `  and  ` "default" ` 
631+ conditions are defined  and implemented in Node.js core,
627632[ as specified above] ( #packages_conditional_exports ) .
628633
634+ The ` "node-addons" `  condition can be used to provide an entry point which
635+ uses native C++ addons. However, this condition can be disabled via the
636+ [ ` --no-addons `  flag] [ ] . When using ` "node-addons" ` , it's recommended to treat
637+ ` "default" `  as an enhancement that provides a more universal entry point, e.g.
638+ using WebAssembly instead of a native addon.
639+ 
629640Other condition strings are unknown to Node.js and thus ignored by default.
630641Runtimes or tools other than Node.js can use them at their discretion.
631642
@@ -1249,6 +1260,7 @@ This field defines [subpath imports][] for the current package.
12491260[` "name"` :  #packages_name
12501261[` "packageManager"` :  #packages_packagemanager
12511262[` "type"` :  #packages_type
1263+ [` --no-addons` :  cli .md #cli_no_addons
12521264[` ERR_PACKAGE_PATH_NOT_EXPORTED` :  errors .md #errors_err_package_path_not_exported
12531265[` esm` :  https: // github.com/standard-things/esm#readme
12541266[` package.json` :  #packages_node_js_package_json_field_definitions
0 commit comments