Skip to content

Commit

Permalink
docs: add warning about using 'main' config
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Sep 26, 2023
1 parent 6ddeb55 commit 3263369
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ more than a year ago. However, some tools still rely on `main`
and have not been updated to read the package entry points via
`exports`.

**Warning: this will likely cause incorrect types to be loaded.**
Use with extreme caution. It's almost always better to _not_
define top-level `main` and `types` fields if you are shipping a
hybrid module. Users will need to update their `module` and
`moduleResolution` tsconfigs appropriately. **That is a good
thing, and will save them future headaches.**

You can tell tshy to export a top-level `main` and `types` field
by setting `main` to either `commonjs` or `esm`. If `main` is set
to `"commonjs"`, then the package will not have `"type":
Expand Down

0 comments on commit 3263369

Please sign in to comment.