@samitouri / QOS-React / commits / 2bcf06b692

[ReactFlightWebpackPlugin] Add support for .mjs file extension (#33028)

## Summary Our builds generate files with a `.mjs` file extension. These are currently filtered out by `ReactFlightWebpackPlugin` so I am updating it to support this file extension. This fixes https://github.com/facebook/react/issues/33155 ## How did you test this change? I built the plugin with this change and used `yalc` to test it in my project. I confirmed the expected files now show up in `react-client-manifest.json`

Jenny Steele committed May 12, 2025 at 18:16 UTC 2bcf06b69254cad6f7e702bf7d65c4f30478668c
1 file changed +8 -2
packages/react-server-dom-webpack/src/ReactFlightWebpackPlugin.js
+8 -2
@@ -277,8 +277,14 @@ export default class ReactFlightWebpackPlugin {
277 chunkGroup.chunks.forEach(function (c) {
278 // eslint-disable-next-line no-for-of-loops/no-for-of-loops
279 for (const file of c.files) {
280 - if (!file.endsWith('.js')) return;
281 - if (file.endsWith('.hot-update.js')) return;
280 + if (!(file.endsWith('.js') || file.endsWith('.mjs'))) {
281 + return;
282 + }
283 + if (
284 + file.endsWith('.hot-update.js') ||
285 + file.endsWith('.hot-update.mjs')
286 + )
287 + return;
288 chunks.push(c.id, file);
289 break;
290 }