tsup or any other tool you prefer to compile your source code into these two formats. You can also choose any other formats like UMD or IIFE as well.
main
, module
, and exports
. You can refer to the official Node.js documentation on package entry points. Additionally, you can use tools like publint and arethetypeswrong to perform checks. There's even a community-created CLI available for arethetypeswrong.module
or moduleResolution
to node16
or nodenext
.entry1.js
, entry1.d.ts
in the root directory and have them point to your compiled artifacts.typesVersions
field to tell the typescript compiler how to find the right files!