Skip to content

Commit 7aa5269

Browse files
committed
fix react-client-manifest id field output
1 parent 959285b commit 7aa5269

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

plugins/react-server-dom-webpack-plugin.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,11 @@ export default class ReactFlightWebpackPlugin {
221221
return c.id;
222222
});
223223

224-
function recordModule(chunk: Chunk, module: Module) {
224+
function recordModule(id: string | number , module: Module) {
225225
// TODO: Hook into deps instead of the target module.
226226
// That way we know by the type of dep whether to include.
227227
// It also resolves conflicts when the same module is in multiple chunks.
228228

229-
// const moduleId = compilation.chunkGraph.getModuleId(module);
230229
if (!/\.client\.(js|ts)x?$/.test((module as any).resource)) {
231230
return
232231
}
@@ -240,7 +239,7 @@ export default class ReactFlightWebpackPlugin {
240239
.concat(Array.isArray(moduleProvidedExports) ? moduleProvidedExports : [])
241240
.forEach(function(name) {
242241
moduleExports[name] = {
243-
id: chunk.id,
242+
id,
244243
chunks: chunkIds,
245244
name: name,
246245
};
@@ -253,15 +252,16 @@ export default class ReactFlightWebpackPlugin {
253252
}
254253

255254
chunkGroup.chunks.forEach(function(chunk) {
256-
// console.log('~~ chunk ~~~', chunk.id);
257255
const chunkModules = compilation.chunkGraph.getChunkModulesIterable(chunk)
258256
for (const module of chunkModules) {
259257

260-
recordModule(chunk, module)
258+
const moduleId = compilation.chunkGraph.getModuleId(module);
259+
260+
recordModule(moduleId, module)
261261
// If this is a concatenation, register each child to the parent ID.
262262
if ((module as any).modules) {
263263
(module as any).modules.forEach((concatenatedMod) => {
264-
recordModule(chunk, concatenatedMod)
264+
recordModule(moduleId, concatenatedMod)
265265
})
266266
}
267267
}

0 commit comments

Comments
 (0)