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

[DOM] Infer react-server entries bundles if not explicitly configured #28795

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions packages/react-dom/src/ReactDOMSharedInternals.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,4 @@ const Internals: ReactDOMInternals = {
usingClientEntryPoint: false,
};

// if (__DEV__) {
// (Internals: any).usingClientEntryPoint = false;
// }

Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this only be added to the internals in DEV? Why is it always added.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was wasting time getting the types right and it’s all getting removed before 19 so I left it as unconditional

export default Internals;
12 changes: 12 additions & 0 deletions scripts/rollup/packaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,18 @@ function filterOutEntrypoints(name) {
hasBundle =
entryPointsToHasBundle.get(entry + '.node') ||
entryPointsToHasBundle.get(entry + '.browser');

// The .react-server and .rsc suffixes may not have a bundle representation but
// should infer their bundle status from the non-suffixed entry point.
if (entry.endsWith('.react-server')) {
hasBundle = entryPointsToHasBundle.get(
entry.slice(0, '.react-server'.length * -1)
);
} else if (entry.endsWith('.rsc')) {
hasBundle = entryPointsToHasBundle.get(
entry.slice(0, '.rsc'.length * -1)
);
}
}
if (hasBundle === undefined) {
// This doesn't exist in the bundles. It's an extra file.
Expand Down