Skip to content

Commit

Permalink
Add exports field to react-dom (#23252)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sebmarkbage committed Feb 8, 2022
1 parent 9d4e8e8 commit 7b541a9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/react-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@
"cjs/",
"umd/"
],
"exports": {
".": "./index.js",
"./server": {
"deno": "./server.browser.js",
"worker": "./server.browser.js",
"browser": "./server.browser.js",
"default": "./server.node.js"
},
"./profiling": "./profiling.js",
"./test-utils": "./test-utils.js",
"./package.json": "./package.json",
"./": "./"
},
"browser": {
"./server.js": "./server.browser.js"
},
Expand Down

0 comments on commit 7b541a9

Please sign in to comment.