Node.js
About this documentation
Usage and example
Assertion testing
Asynchronous context tracking
Async hooks
Buffer
C++ addons
C/C++ addons with Node-API
C++ embedder API
Child processes
Cluster
Command-line options
Console
Corepack
Crypto
Debugger
Deprecated APIs
Diagnostics Channel
DNS
Domain
Errors
Events
File system
Globals
HTTP
HTTP/2
HTTPS
Inspector
Internationalization
Modules: CommonJS modules
Modules: ECMAScript modules
Modules:
node:module
API
Modules: Packages
Net
OS
Path
Performance hooks
Permissions
Process
Punycode
Query strings
Readline
REPL
Report
Single executable applications
Stream
String decoder
Test runner
Timers
TLS/SSL
Trace events
TTY
UDP/datagram
URL
Utilities
V8
VM
WASI
Web Crypto API
Web Streams API
Worker threads
Zlib
Code repository and issue tracker
Node.js v20.14.0 documentation
Node.js v20.14.0
Table of contents
Modules: Packages
Introduction
Determining module system
Introduction
Modules loaders
package.json
and file extensions
--input-type
flag
Determining package manager
Package entry points
Main entry point export
Subpath exports
Extensions in subpaths
Exports sugar
Subpath imports
Subpath patterns
Conditional exports
Nested conditions
Resolving user conditions
Community Conditions Definitions
Self-referencing a package using its name
Dual CommonJS/ES module packages
Dual package hazard
Writing dual packages while avoiding or minimizing hazards
Approach #1: Use an ES module wrapper
Approach #2: Isolate state
Node.js
package.json
field definitions
"name"
"main"
"packageManager"
"type"
"exports"
"imports"
Index
About this documentation
Usage and example
Index
Assertion testing
Asynchronous context tracking