Skip to content

Commit

Permalink
fix: ESM default export and typings files
Browse files Browse the repository at this point in the history
In projects with a `moduleResolution` set to `node`,
TypeScript can't find the `/app` and `/pages`
imports as there aren't any .d.ts files named that way
at the root of the package.

Attempting to resolve this problem by simlinking
those files to their counterparts in `dist/`
  • Loading branch information
franky47 committed Aug 30, 2023
1 parent 1af26c5 commit 1b164db
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
},
"files": [
"dist/",
"useQueryState.gif"
"useQueryState.gif",
"app.d.ts",
"pages.d.ts"
],
"type": "module",
"sideEffects": false,
Expand All @@ -34,7 +36,7 @@
"types": "dist/index.d.ts",
"exports": {
".": {
"imports": "./dist/index.js",
"import": "./dist/index.js",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
},
Expand Down Expand Up @@ -72,7 +74,8 @@
"cypress:run": "cypress run --headless",
"ci": "run-s build test:types",
"e2e": "run-s cypress:install test:e2e:next:build test:e2e:ci",
"prepare": "husky install"
"prepare": "husky install",
"prepack": "ln -s ./dist/app.d.ts app.d.ts && ln -s ./dist/pages.d.ts pages.d.ts"
},
"peerDependencies": {
"next": "^13",
Expand Down

0 comments on commit 1b164db

Please sign in to comment.