Configuring Dynamic Entry Points for Node Packages: main, type, exports, and module fields
Library authors can configure package.json using main, type, exports, and module fields to provide separate CommonJS and ES module entry points, enabling runtime selection based on import or require, improving tree‑shaking, bundler compatibility, and TypeScript type resolution while restricting undefined sub‑paths.