Skip to content

Include conditional exports in package.json #31

Description

Currently, we have main and module in the package.json which specify the entry point for cjs and esm. ref

exports is supported by Node.js 12+ ref

Note that exports will take precedence over the main field: https://nodejs.org/api/packages.html#main

The exports field can produce extra extensibility, for example, tools like webpack will know some specific fields. ref

BTW, this is how azure sdk does: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-auth/package.json
I prefer to follow azure sdk.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions