Skip to content

Commit

Permalink
fix(filter): Skip modules that do not belong to any chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
vio committed Oct 11, 2023
1 parent 98e97e8 commit 5418a1c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
5 changes: 5 additions & 0 deletions packages/plugin-webpack-filter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ export default (
(chunkId) => chunkId !== null && typeof chunkId !== 'undefined',
) || [];

// Skip modules that do not belong to any chunk
if (moduleChunks.length === 0) {
return agg;
}

const concatenatedModules = moduleStats.modules?.reduce(
(aggConcatenatedModules, concatenatedModule) => {
if (!concatenatedModule.name) {
Expand Down
5 changes: 0 additions & 5 deletions packages/utils/__fixtures__/webpack-stats-1.extracted.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ module.exports = {
name: 'module-b',
size: 2000,
},
{
chunks: [],
name: 'module-c',
size: 1000,
},
{
chunks: [1],
name: 'node_modules/package-a/index.js',
Expand Down
10 changes: 0 additions & 10 deletions packages/utils/src/jobs/__tests__/__snapshots__/create-job.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,6 @@ exports[`createJob no baseline 1`] = `
"name": "module-b",
"size": 2000,
},
{
"chunks": [],
"name": "module-c",
"size": 1000,
},
{
"chunks": [
1,
Expand Down Expand Up @@ -656,11 +651,6 @@ exports[`createJob with baseline 1`] = `
"name": "module-b",
"size": 2000,
},
{
"chunks": [],
"name": "module-c",
"size": 1000,
},
{
"chunks": [
1,
Expand Down

0 comments on commit 5418a1c

Please sign in to comment.