Skip to content

Commit 94aa365

Browse files
authored
[Flight] Fix webpack plugin to use chunk groups (#20421)
1 parent 842ee36 commit 94aa365

1 file changed

Lines changed: 22 additions & 19 deletions

File tree

packages/react-server-dom-webpack/src/ReactFlightWebpackPlugin.js

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -170,26 +170,29 @@ export default class ReactFlightWebpackPlugin {
170170

171171
compiler.hooks.emit.tap(PLUGIN_NAME, compilation => {
172172
const json = {};
173-
compilation.chunks.forEach(chunk => {
174-
chunk.getModules().forEach(mod => {
175-
// TOOD: Hook into deps instead of the target module.
176-
// That way we know by the type of dep whether to include.
177-
// It also resolves conflicts when the same module is in multiple chunks.
178-
if (!/\.client\.js$/.test(mod.resource)) {
179-
return;
180-
}
181-
const moduleExports = {};
182-
['', '*'].concat(mod.buildMeta.providedExports).forEach(name => {
183-
moduleExports[name] = {
184-
id: mod.id,
185-
chunks: chunk