Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/dull-gifts-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@clerk/clerk-react": patch
"@clerk/remix": patch
"@clerk/shared": patch
---

Make `types` the first key in all `exports` maps defined in our packages' `package.json`. The [TypeScript docs](https://www.typescriptlang.org/docs/handbook/esm-node.html#packagejson-exports-imports-and-self-referencing) recommends so, as the the `exports` map is order-based.
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"types": "./dist/types/index.d.ts",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"types": "./dist/types/index.d.ts"
"require": "./dist/cjs/index.js"
}
},
"files": [
Expand Down
15 changes: 12 additions & 3 deletions packages/remix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,18 @@
"types": "dist/index.d.ts",
"sideEffects": false,
"exports": {
".": "./dist/index.js",
"./ssr.server": "./dist/ssr/index.js",
"./api.server": "./dist/api/index.js"
".": {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anagstef @LekoArts
Could you please verify that this is correct?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Looking at https://webpack.js.org/guides/package-exports/#conditional-syntax

The last condition in the object might be the special "default" condition, which is always matched.

I'm not 100% sure if we could use require here, but default seems like a safe bet for now

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly - used default as it should mimic the exports behavior we had before. Thank you!

"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./ssr.server": {
"types": "./dist/ssr/index.d.ts",
"default": "./dist/ssr/index.js"
},
"./api.server": {
"types": "./dist/api/index.d.ts",
"default": "./dist/api/index.js"
}
},
"typesVersions": {
"*": {
Expand Down
8 changes: 4 additions & 4 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
],
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"types": "./dist/types/index.d.ts"
"require": "./dist/cjs/index.js"
},
"./testUtils": {
"types": "./dist/types/testUtils/index.d.ts",
"import": "./dist/esm/testUtils/index.js",
"require": "./dist/cjs/testUtils/index.js",
"types": "./dist/types/testUtils/index.d.ts"
"require": "./dist/cjs/testUtils/index.js"
}
},
"scripts": {
Expand Down