Skip to content

Commit 7b541a9

Browse files
authored
Add exports field to react-dom (#23252)
This configures the exports field for react-dom. Notably there are some conditions for the /server entry point where we pick the export based on environments. Most environments now support Web Streams which is preferred in those environments. We already do this using the "browser" field so the "browser" condition applies here too. I don't think it's necessary, but I also specified "worker" explicitly since this is for Service Workers and those are often targeted with Web Pack's "webworker" target, which is also what Cloudflare currently recommends. I also added "deno" but deno is a bit special because this only works if you run with the node compatibility since otherwise you have to specify absolute URLs for the imports.
1 parent 9d4e8e8 commit 7b541a9

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

packages/react-dom/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@
3838
"cjs/",
3939
"umd/"
4040
],
41+
"exports": {
42+
".": "./index.js",
43+
"./server": {
44+
"deno": "./server.browser.js",
45+
"worker": "./server.browser.js",
46+
"browser": "./server.browser.js",
47+
"default": "./server.node.js"
48+
},
49+
"./profiling": "./profiling.js",
50+
"./test-utils": "./test-utils.js",
51+
"./package.json": "./package.json",
52+
"./": "./"
53+
},
4154
"browser": {
4255
"./server.js": "./server.browser.js"
4356
},

0 commit comments

Comments
 (0)