Skip to content

Commit 5ce8667

Browse files
authored
temporarily only use one build in export map (#12437)
With the export map before this commit, there’s a react router context mismatch in react-router-dev because the node process from `react-router dev` isn’t started with `—conditions development`, so it required the production build of `react-router` (because it’s used internally in `react-router-dev`. Then for the server render, “react-router” is already in the cache so if any node_modules have a peer dep on it, it gets the production build too. After that, app code runs and asks for “react-router” but this import is processed through vite with the “development” condition, so the app gets a different version of react router Now if a node_module want’s to useLocation inside of the app, it’s got a different copy of that hook and no router context This is a temporary patch until we can work out how to get `react-router dev` to get the development build in node without requiring apps to set the conditions
1 parent aed1b45 commit 5ce8667

File tree

2 files changed

+24
-31
lines changed

2 files changed

+24
-31
lines changed

.changeset/curvy-readers-notice.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-router": patch
3+
---
4+
5+
temporarily only use one build in export map so packages can have a peer dependency on react router

packages/react-router/package.json

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,58 +18,46 @@
1818
"license": "MIT",
1919
"author": "Remix Software <[email protected]>",
2020
"sideEffects": false,
21-
"types": "./dist/production/index.d.ts",
22-
"main": "./dist/production/index.js",
23-
"module": "./dist/production/index.mjs",
21+
"types": "./dist/development/index.d.ts",
22+
"main": "./dist/development/index.js",
23+
"module": "./dist/development/index.mjs",
2424
"exports": {
2525
".": {
2626
"node": {
27-
"types": "./dist/production/index.d.ts",
28-
"development": {
29-
"module-sync": "./dist/development/index.mjs",
30-
"default": "./dist/development/index.js"
31-
},
32-
"module-sync": "./dist/production/index.mjs",
33-
"default": "./dist/production/index.js"
27+
"types": "./dist/development/index.d.ts",
28+
"module-sync": "./dist/development/index.mjs",
29+
"default": "./dist/development/index.js"
3430
},
3531
"import": {
36-
"types": "./dist/production/index.d.mts",
37-
"development": "./dist/development/index.mjs",
38-
"default": "./dist/production/index.mjs"
32+
"types": "./dist/development/index.d.mts",
33+
"default": "./dist/development/index.mjs"
3934
},
4035
"default": {
41-
"types": "./dist/production/index.d.ts",
42-
"development": "./dist/development/index.js",
43-
"default": "./dist/production/index.js"
36+
"types": "./dist/development/index.d.ts",
37+
"default": "./dist/development/index.js"
4438
}
4539
},
4640
"./route-module": {
4741
"import": {
48-
"types": "./dist/production/lib/types/route-module.d.mts"
42+
"types": "./dist/development/lib/types/route-module.d.mts"
4943
},
5044
"default": {
51-
"types": "./dist/production/lib/types/route-module.d.ts"
45+
"types": "./dist/development/lib/types/route-module.d.ts"
5246
}
5347
},
5448
"./dom": {
5549
"node": {
56-
"types": "./dist/production/dom-export.d.ts",
57-
"development": {
58-
"module-sync": "./dist/development/dom-export.mjs",
59-
"default": "./dist/development/dom-export.js"
60-
},
61-
"module-sync": "./dist/production/dom-export.mjs",
62-
"default": "./dist/production/dom-export.js"
50+
"types": "./dist/development/dom-export.d.ts",
51+
"module-sync": "./dist/development/dom-export.mjs",
52+
"default": "./dist/development/dom-export.js"
6353
},
6454
"import": {
65-
"types": "./dist/production/dom-export.d.mts",
66-
"development": "./dist/development/dom-export.mjs",
67-
"default": "./dist/production/dom-export.mjs"
55+
"types": "./dist/development/dom-export.d.mts",
56+
"default": "./dist/development/dom-export.mjs"
6857
},
6958
"default": {
70-
"types": "./dist/production/dom-export.d.ts",
71-
"development": "./dist/development/dom-export.js",
72-
"default": "./dist/production/dom-export.js"
59+
"types": "./dist/development/dom-export.d.ts",
60+
"default": "./dist/development/dom-export.js"
7361
}
7462
},
7563
"./package.json": "./package.json"

0 commit comments

Comments
 (0)