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 a module map option to the Webpack Flight Client #24629

Merged
merged 1 commit into from
May 27, 2022

Conversation

sebmarkbage
Copy link
Collaborator

On the server we have a similar translation map from the file path that the loader uses to the refer to the original module and to the bundled module ID.

The Flight server is optimized to emit the smallest format for the client. However during SSR, the same client component might go by a different module ID since it's a different bundle than the client bundle.

This provides an option to add a translation map from client ID to SSR ID when reading the Flight stream.

Ideally we should have a special SSR Flight Client that takes this option but for now we only have one Client for both.

@sizebot
Copy link

sizebot commented May 27, 2022

Comparing: 3133dfa...2f9a4b6

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 = 131.28 kB 131.28 kB = 42.13 kB 42.13 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 136.54 kB 136.54 kB = 43.68 kB 43.68 kB
facebook-www/ReactDOM-prod.classic.js = 439.35 kB 439.35 kB = 80.29 kB 80.29 kB
facebook-www/ReactDOM-prod.modern.js = 424.64 kB 424.64 kB = 78.13 kB 78.13 kB
facebook-www/ReactDOMForked-prod.classic.js = 439.35 kB 439.35 kB = 80.29 kB 80.29 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js +4.06% 4.00 kB 4.16 kB +3.23% 1.80 kB 1.85 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js +4.06% 4.00 kB 4.16 kB +3.23% 1.80 kB 1.85 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js +4.06% 4.00 kB 4.16 kB +3.23% 1.80 kB 1.85 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js +3.87% 4.22 kB 4.38 kB +3.16% 1.90 kB 1.96 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js +3.87% 4.22 kB 4.38 kB +3.16% 1.90 kB 1.96 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js +3.87% 4.22 kB 4.38 kB +3.16% 1.90 kB 1.96 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js +2.40% 16.36 kB 16.76 kB +1.42% 4.71 kB 4.78 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js +2.40% 16.36 kB 16.76 kB +1.42% 4.71 kB 4.78 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js +2.40% 16.36 kB 16.76 kB +1.42% 4.71 kB 4.78 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack.development.js +2.27% 17.58 kB 17.98 kB +1.34% 4.84 kB 4.91 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack.development.js +2.27% 17.58 kB 17.98 kB +1.34% 4.84 kB 4.91 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack.development.js +2.27% 17.58 kB 17.98 kB +1.34% 4.84 kB 4.91 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js +4.06% 4.00 kB 4.16 kB +3.23% 1.80 kB 1.85 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js +4.06% 4.00 kB 4.16 kB +3.23% 1.80 kB 1.85 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js +4.06% 4.00 kB 4.16 kB +3.23% 1.80 kB 1.85 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js +3.87% 4.22 kB 4.38 kB +3.16% 1.90 kB 1.96 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js +3.87% 4.22 kB 4.38 kB +3.16% 1.90 kB 1.96 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js +3.87% 4.22 kB 4.38 kB +3.16% 1.90 kB 1.96 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js +2.40% 16.36 kB 16.76 kB +1.42% 4.71 kB 4.78 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js +2.40% 16.36 kB 16.76 kB +1.42% 4.71 kB 4.78 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js +2.40% 16.36 kB 16.76 kB +1.42% 4.71 kB 4.78 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack.development.js +2.27% 17.58 kB 17.98 kB +1.34% 4.84 kB 4.91 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack.development.js +2.27% 17.58 kB 17.98 kB +1.34% 4.84 kB 4.91 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack.development.js +2.27% 17.58 kB 17.98 kB +1.34% 4.84 kB 4.91 kB
facebook-relay/flight/ReactFlightNativeRelayClient-dev.js +1.83% 10.58 kB 10.78 kB +1.52% 3.16 kB 3.21 kB
facebook-www/ReactFlightDOMRelayClient-dev.modern.js +1.52% 12.74 kB 12.94 kB +1.22% 3.76 kB 3.80 kB
facebook-www/ReactFlightDOMRelayClient-dev.classic.js +1.52% 12.75 kB 12.94 kB +1.22% 3.76 kB 3.80 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-client.development.js +1.42% 1.48 kB 1.51 kB +2.29% 0.70 kB 0.71 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-client.development.js +1.42% 1.48 kB 1.51 kB +2.29% 0.70 kB 0.71 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-client.development.js +1.42% 1.48 kB 1.51 kB +2.29% 0.70 kB 0.71 kB
facebook-relay/flight/ReactFlightNativeRelayClient-prod.js +1.09% 6.14 kB 6.20 kB +1.19% 1.84 kB 1.87 kB
facebook-www/ReactFlightDOMRelayClient-prod.classic.js +1.07% 6.28 kB 6.34 kB +1.16% 1.90 kB 1.92 kB
facebook-www/ReactFlightDOMRelayClient-prod.modern.js +1.07% 6.28 kB 6.34 kB +1.16% 1.90 kB 1.92 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-client.production.min.js +0.97% 0.72 kB 0.73 kB +0.22% 0.45 kB 0.45 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-client.production.min.js +0.97% 0.72 kB 0.73 kB +0.22% 0.45 kB 0.45 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-client.production.min.js +0.97% 0.72 kB 0.73 kB +0.22% 0.45 kB 0.45 kB
oss-experimental/react-client/cjs/react-client-flight.development.js +0.95% 13.82 kB 13.95 kB +0.59% 4.07 kB 4.10 kB
oss-stable-semver/react-client/cjs/react-client-flight.development.js +0.95% 13.82 kB 13.95 kB +0.59% 4.07 kB 4.10 kB
oss-stable/react-client/cjs/react-client-flight.development.js +0.95% 13.82 kB 13.95 kB +0.59% 4.07 kB 4.10 kB
oss-experimental/react-client/cjs/react-client-flight.production.min.js +0.94% 3.71 kB 3.75 kB +0.53% 1.70 kB 1.71 kB
oss-stable-semver/react-client/cjs/react-client-flight.production.min.js +0.94% 3.71 kB 3.75 kB +0.53% 1.70 kB 1.71 kB
oss-stable/react-client/cjs/react-client-flight.production.min.js +0.94% 3.71 kB 3.75 kB +0.53% 1.70 kB 1.71 kB

Generated by 🚫 dangerJS against 2f9a4b6

On the server we have a similar translation map from the file path that the
loader uses to the refer to the original module and to the bundled module ID.

The Flight server is optimized to emit the smallest format for the client.
However during SSR, the same client component might go by a different
module ID since it's a different bundle than the client bundle.

This provides an option to add a translation map from client ID to SSR ID
when reading the Flight stream.

Ideally we should have a special SSR Flight Client that takes this option
but for now we only have one Client for both.
@sebmarkbage sebmarkbage merged commit 1bed207 into facebook:main May 27, 2022
kodiakhq bot pushed a commit to vercel/next.js that referenced this pull request Jun 2, 2022
Adopt the new `moduleMap` option added in facebook/react#24629, which helps us getting rid of our hacky implementation injected to `globalThis.__next_require__`. The map will be attached to the flight manifest as `__ssr_module_mapping__`.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Jun 6, 2022
Summary:
This sync includes the following changes:
- **[dd4950c90](facebook/react@dd4950c90 )**: [Flight] Implement useId hook ([#24172](facebook/react#24172)) //<Josh Story>//
- **[26a5b3c7f](facebook/react@26a5b3c7f )**: Explicitly set `highWaterMark` to 0 for `ReadableStream` ([#24641](facebook/react#24641)) //<Josh Larson>//
- **[aec575914](facebook/react@aec575914 )**: [Fizz] Send errors down to client ([#24551](facebook/react#24551)) //<Josh Story>//
- **[a2766387e](facebook/react@a2766387e )**: [Fizz] Improve text separator byte efficiency ([#24630](facebook/react#24630)) //<Josh Story>//
- **[f7860538a](facebook/react@f7860538a )**: Fix typo in useSyncExternalStore main entry point error ([#24631](facebook/react#24631)) //<François Chalifour>//
- **[1bed20731](facebook/react@1bed20731 )**: Add a module map option to the Webpack Flight Client ([#24629](facebook/react#24629)) //<Sebastian Markbåge>//
- **[b2763d3ea](facebook/react@b2763d3ea )**: Move hydration code out of normal Suspense path ([#24532](facebook/react#24532)) //<Andrew Clark>//
- **[357a61324](facebook/react@357a61324 )**: [DevTools][Transition Tracing] Added support for Suspense Boundaries ([#23365](facebook/react#23365)) //<Luna Ruan>//
- **[2c8a1452b](facebook/react@2c8a1452b )**: Fix ignored setState in Safari when iframe is touched ([#24459](facebook/react#24459)) //<dan>//
- **[62662633d](facebook/react@62662633d )**: Remove enableFlipOffscreenUnhideOrder ([#24545](facebook/react#24545)) //<Ricky>//
- **[34da5aa69](facebook/react@34da5aa69 )**: Only treat updates to lazy as a new mount in legacy mode ([#24530](facebook/react#24530)) //<Ricky>//
- **[46a6d77e3](facebook/react@46a6d77e3 )**: Unify JSResourceReference Interfaces ([#24507](facebook/react#24507)) //<Timothy Yung>//
- **[6cbf0f7fa](facebook/react@6cbf0f7fa )**: Fork ReactSymbols ([#24484](facebook/react#24484)) //<Ricky>//
- **[a10a9a6b5](facebook/react@a10a9a6b5 )**: Add test for hiding children after layout destroy ([#24483](facebook/react#24483)) //<Ricky>//
- **[b4eb0ad71](facebook/react@b4eb0ad71 )**: Do not replay erroring beginWork with invokeGuardedCallback when suspended or previously errored ([#24480](facebook/react#24480)) //<Josh Story>//
- **[99eef9e2d](facebook/react@99eef9e2d )**: Hide children of Offscreen after destroy effects ([#24446](facebook/react#24446)) //<Ricky>//
- **[ce1386028](facebook/react@ce1386028 )**: Remove enablePersistentOffscreenHostContainer flag ([#24460](facebook/react#24460)) //<Andrew Clark>//
- **[72b7462fe](facebook/react@72b7462fe )**: Bump local package.json versions for 18.1 release ([#24447](facebook/react#24447)) //<Andrew Clark>//
- **[22edb9f77](facebook/react@22edb9f77 )**: React `version` field should match package.json ([#24445](facebook/react#24445)) //<Andrew Clark>//
- **[6bf3deef5](facebook/react@6bf3deef5 )**: Upgrade react-shallow-renderer to support react 18 ([#24442](facebook/react#24442)) //<Michael サイトー 中村 Bashurov>//

Changelog:
[General][Changed] - React Native sync for revisions bd4784c...d300ceb

jest_e2e[run_all_tests]

Reviewed By: cortinico, kacieb

Differential Revision: D36874368

fbshipit-source-id: c0ee015f4ef2fa56e57f7a1f6bc37dd05c949877
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