

Adding this For more information on how Node.js determines the difference between ESM and CJS modules take a look at the Node.js official docs here Specify a license For Common JS (CJS) modules, use commonjs.

The type field defines the module format that Node.js will use. For our opossum module, we set this field to true and supplied our support information in a separate package-support.json file.įor more information on the support field, read the Package Maintenance Team statements.

The team has worked closely with the Node.js Package Maintenance Team on their recommendations for what this support field should look like. The support field will help package maintainers communicate with and set expectations for their users about the level of support they are willing to provide on a package. For a list of the files that are automatically included, check out the npm docs. The team recommends not to include tests, which should reduce the package size. This field is handy when using a bundler to transpile code, and you only want to include that transpiled code. The files field is a list of files that you want to be published with your package. To see the full list, check out the npm package development section of the Node.js Reference Architecture. The following sections provide details about those fields as well as other recommendations. While name and version are the only fields that are required to publish a package, the team recommends completing a few other fields to provide more information to the user. To read more about this feature, check out the official npm documentation. This command can be modified to tailor the results to your specific organization's needs.

You can even accept all the defaults by providing the -y flag when running the following command: npm init -y When starting the creation of a new package, it is recommended to use the npm init command instead of hand coding to quickly and accurately create a new package.json.
