Skip to content

Commit

Permalink
fix: Add support for TS 4.7+ node16/next module
Browse files Browse the repository at this point in the history
in TS 4.7+, TS introduced a node16/next module mode.

in this mode, if libraries are using "exports" field on package.json,
each "exports" field needs "types" field, or fail to load typings.

for more information, see release note: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#esm-nodejs
  • Loading branch information
rinsuki authored Jun 30, 2022
1 parent 764f70d commit a0c099b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
"unpkg": "./dist/react-intersection-observer.umd.js",
"types": "./dist/index.d.ts",
"exports": {
"./test-utils": "./dist/test-utils.js",
"./test-utils": {
"types": "./dist/test-utils.d.ts",
"default": "./dist/test-utils.js"
},
".": {
"types": "./dist/index.d.ts",
"require": "./dist/react-intersection-observer.js",
"default": "./dist/react-intersection-observer.modern.mjs"
}
Expand Down

0 comments on commit a0c099b

Please sign in to comment.