Skip to content

Commit

Permalink
Prefer require, import and types exports over browser
Browse files Browse the repository at this point in the history
Exports are resolved in order, i.e. the first match is used.

I'm not sure why the browser export is using the raw src, however this causes issues with Jest when configured with jsdom, as it will resolve to this file and not be able to transpile it. Jest also throws a type error as discussed on remix-run/remix#3402
  • Loading branch information
penx committed Jun 6, 2022
1 parent f5a5e15 commit 2f9ecb9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-dolls-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/web-fetch": patch
---

Prefer require, import and types exports over browser export
4 changes: 2 additions & 2 deletions packages/fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"type": "module",
"exports": {
".": {
"browser": "./src/lib.js",
"require": "./dist/lib.node.cjs",
"import": "./src/lib.node.js",
"types": "./dist/src/lib.node.d.ts"
"types": "./dist/src/lib.node.d.ts",
"browser": "./src/lib.js"
},
"./package.json": "./package.json",
"./body": {
Expand Down

0 comments on commit 2f9ecb9

Please sign in to comment.