https://nodejs.org/api/packages.html

package.json详解 (opens new window)

"type"

The "type" field defines the module format that Node.js uses for all .js files that have that package.json file as their nearest parent.

When set to "module", the type field allows a package to specify all .js files within are ES modules. If the "type" field is omitted or set to "commonjs", all .js files are treated as CommonJS.