GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Flight] Fix webpack plugin to use chunk groups (#20421) · react/react@94aa365

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/react-server-dom-webpack/src
    • ReactFlightWebpackPlugin.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: packages/react-server-dom-webpack/src/ReactFlightWebpackPlugin.js
+22-19Lines 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.ids,
186-
name: name,
187-
};
173+
compilation.chunkGroups.forEach(chunkGroup => {
174+
const chunkIds = chunkGroup.chunks.map(c => c.id);
175+
chunkGroup.chunks.forEach(chunk => {
176+
chunk.getModules().forEach(mod => {
177+
// TODO: Hook into deps instead of the target module.
178+
// That way we know by the type of dep whether to include.
179+
// It also resolves conflicts when the same module is in multiple chunks.
180+
if (!/\.client\.js$/.test(mod.resource)) {
181+
return;
182+
}
183+
const moduleExports = {};
184+
['', '*'].concat(mod.buildMeta.providedExports).forEach(name => {
185+
moduleExports[name] = {
186+
id: mod.id,
187+
chunks: chunkIds,
188+
name: name,
189+
};
190+
});
191+
const href = pathToFileURL(mod.resource).href;
192+
if (href !== undefined) {
193+
json[href] = moduleExports;
194+
}
188195
});
189-
const href = pathToFileURL(mod.resource).href;
190-
if (href !== undefined) {
191-
json[href] = moduleExports;
192-
}
193196
});
194197
});
195198
const output = JSON.stringify(json, null, 2);

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.