1 min read

PACKAGE_JSON_TYPE_REQUIRED

Requires that every package.json file has the type field set to encourage using ES Modules since commonjs is the default.
Table of Contents

Conformance is available on Enterprise plans

This check ensures that every package.json has a type field. This field determines how files within the workspace are treated by default. Files are treated as CommonJS by default. However, the new recommendation is to use ES Modules.

This field is required so that packages explicitly choose which module format to use, preferring ES Modules when possible.

See the Node.js docs for more information.

The type field should be set to module when possible, although there are still situations where commonjs has to be used.

Last updated on February 21, 2024