main and module fields
Older package.json fields: main names the CommonJS entry file and module (a bundler convention) names an ECMAScript module version.
In more detail
They cannot hide internal files or give separate type files per format. Packages still include them for old tools, but the exports field takes precedence where supported.
Related terms
- exports field — The package.json field that lists exactly which files a package exposes, by path such as "." or "./button", and which file to use in each situation.
- package.json — The JSON file at the root of every JavaScript package that records its name, version, dependencies, entry points and other settings.
Taught in
- Component Packaging: Dual ESM/CJS Builds & Package Exports — Design Systems & Component Engineering