Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assets: Fix the order of the chunk files (2nd try) #96100

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Get rid of fallback
  • Loading branch information
arthur791004 committed Nov 6, 2024
commit bd84dd4636c624395d9baf41672c7bba4b7422a2
80 changes: 0 additions & 80 deletions bin/loader-stats.js

This file was deleted.

3 changes: 0 additions & 3 deletions build-tools/webpack/assets-writer-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ Object.assign( AssetsWriter.prototype, {
Object.assign( {}, chunk, {
chunks: stats.namedChunkGroups[ chunk.id ]?.chunks,
files: chunk.files.map( fixupPath ),
siblings: _.reject( chunk.siblings, ( sibling ) =>
String( sibling ).startsWith( this.options.runtimeChunk )
),
} )
);

Expand Down
12 changes: 7 additions & 5 deletions client/server/middleware/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ export default () => {
return EMPTY_ASSETS;
}

const allTheFiles = chunk.chunks
? flatten( chunk.chunks.map( ( chunkId ) => getChunkById( assets, chunkId ).files ) )
: chunk.files.concat(
flatten( chunk.siblings.map( ( sibling ) => getChunkById( assets, sibling ).files ) )
);
if ( ! chunk.chunks ) {
console.warn( 'cannot find the chunks of the chunk ' + chunkName );
return EMPTY_ASSETS;
}

const allTheFiles = flatten(
chunk.chunks.map( ( chunkId ) => getChunkById( assets, chunkId ).files )
);
return groupAssetsByType( allTheFiles );
};

Expand Down