Closed
Description
I'm adding the ReactFlightWebpackPlugin to my project to use server components. The generated react-client-manifest.json
does not have any chunks in it. Upon checking the code I see it is specifically only adding files with .js
file extension to the chunk list here: https://github.com/facebook/react/blob/main/packages/react-server-dom-webpack/src/ReactFlightWebpackPlugin.js#L280 My project's webpack build generates files with .mjs
file extensions.
I have a proposed fix PR here: #33028
React version: 19.1.0
Steps To Reproduce
- Configure webpack to generate files with a .mjs file extension. Example:
module.exports = {
//...
output: {
//...
chunkFilename: '[name].mjs',
filename: '[name].mjs',
},
};
- Add the plugin to the webpack config. Example:
const ReactServerWebpackPlugin = require("react-server-dom-webpack/plugin");
module.exports = {
//...
plugins: [new ReactServerWebpackPlugin({ isServer: false })],
};
- Set up one client component as directed in the documentation for server components.
- Run the webpack build
- Observe that the generated file
react-client-manifest.json
has empty arrays for the "chunks" list. Sample output:
{
"file://path/Example.tsx": {
"id": "./path/Example.tsx",
"chunks": [],
"name": "*"
}
}
Link to code example:
I don't have a full code example, but I have a fix PR here: #33028
The current behavior
No chunks listed in react-client-manifest.json
The expected behavior
Chunks listed in react-client-manifest.json
. Testing locally after my PR I see these contents:
{
"file://path/Example.tsx": {
"id": "./path/Example.tsx",
"chunks": [
"client0",
"client0-2c4986f8fb78b0ce.mjs"
],
"name": "*"
}
}