dillon1000/react

Commit

[Flight] Instrument the Promise for Async Module instead of using a Module Cache (#26985)

Currently, since we use a module cache for async modules, it doesn't
automatically get updated when the module registry gets updated (HMR).

This technique ensures that if Webpack replaces the module (HMR) then
we'll get the new Promise when we require it again.

This technique doesn't work for ESM and probably not Vite since ESM will
provide a new Promise each time you call `import()` but in the
Webpack/CJS approach this Promise is an entry in the module cache and
not a promise for the entry.

I tried to replicate the original issue in the fixture but it's tricky
to replicate because 1) we can't really use async modules the same way
without compiling both server and client 2) even then I'm not quite sure
how to repro the HMR issue.
Browse files
Changed paths13 files
First-parent comparison
D fixtures/flight/config/jest/babelTransform.js DeletedD fixtures/flight/config/jest/cssTransform.js DeletedD fixtures/flight/config/jest/fileTransform.js DeletedM fixtures/flight/config/webpack.config.js ModifiedM fixtures/flight/package.json ModifiedM fixtures/flight/server/global.js ModifiedM fixtures/flight/server/region.js ModifiedM fixtures/flight/src/App.js ModifiedA fixtures/flight/src/cjs/Counter3.js AddedA fixtures/flight/src/cjs/package.json AddedM fixtures/flight/yarn.lock ModifiedM packages/react-server-dom-webpack/src/ReactFlightClientConfigNodeBundler.js ModifiedM packages/react-server-dom-webpack/src/ReactFlightClientConfigWebpackBundler.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…