Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing "react-dom/server.bun" entry in package.json "exports" #26402

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

Jarred-Sumner
Copy link
Contributor

@Jarred-Sumner Jarred-Sumner commented Mar 16, 2023

Summary

react-dom/server in Bun (correctly) chooses react-dom/server.bun, but react-dom/server.bun currently can't be imported because it is not included in package.json "exports" (react-dom/server works, react-dom/server.bun doesn't). Previously, I didn't think it was necessary to do that, but it is too easy to accidentally run the browser build in unit tests when importing react-dom/server

This also aligns behavior of package.json "exports" of react-dom/server.bun with react-dom/server.browser, react-dom/server.node, and the rest.

How did you test this change?

Manually edited package.json in node_modules in a separate folder and ran tests in Bun with react-dom/server.bun as the import specifier

This aligns behavior of package.json exports of `react-dom/server.bun` with `react-dom/server.browser`, `react-dom/server.node`, and the rest. 

Mostly suggesting this so that in unit tests, its clearer that it is using the `react-dom/server.bun`
@Jarred-Sumner Jarred-Sumner changed the title Add missing "react-dom/server.bun" entry in package.json exports Add missing "react-dom/server.bun" entry in package.json "exports" Mar 16, 2023
@react-sizebot
Copy link

Comparing: 99aa082...8293ff1

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 157.42 kB 157.42 kB = 50.15 kB 50.15 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 159.01 kB 159.01 kB = 50.66 kB 50.66 kB
facebook-www/ReactDOM-prod.classic.js = 541.42 kB 541.42 kB = 96.42 kB 96.42 kB
facebook-www/ReactDOM-prod.modern.js = 525.15 kB 525.15 kB = 93.94 kB 93.94 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 8293ff1

Copy link
Collaborator

@acdlite acdlite left a comment

Choose a reason for hiding this comment

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

Makes sense, thanks!

@acdlite acdlite merged commit e4606c1 into facebook:main Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants