@@ -32,7 +32,8 @@ const ErrorHelpers = require("./ErrorHelpers");
3232const FileSystemInfo = require ( "./FileSystemInfo" ) ;
3333const {
3434 connectChunkGroupAndChunk,
35- connectChunkGroupParentAndChild
35+ connectChunkGroupParentAndChild,
36+ connectEntrypointAndDependOn
3637} = require ( "./GraphHelpers" ) ;
3738const {
3839 makeWebpackError,
@@ -3207,7 +3208,6 @@ Remove the 'runtime' option from the entrypoint.`);
32073208 const referencedChunks = entry
32083209 . getEntrypointChunk ( )
32093210 . getAllReferencedChunks ( ) ;
3210- const dependOnEntries = [ ] ;
32113211 for ( const dep of dependOn ) {
32123212 const dependency = this . entrypoints . get ( dep ) ;
32133213 if ( ! dependency ) {
@@ -3225,9 +3225,7 @@ Remove the 'runtime' option from the entrypoint.`);
32253225 entry . setRuntimeChunk ( entryChunk ) ;
32263226 continue outer;
32273227 }
3228- dependOnEntries . push ( dependency ) ;
3229- }
3230- for ( const dependency of dependOnEntries ) {
3228+ connectEntrypointAndDependOn ( entry , dependency ) ;
32313229 connectChunkGroupParentAndChild ( dependency , entry ) ;
32323230 }
32333231 } else if ( runtime ) {
@@ -3278,26 +3276,6 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
32783276 }
32793277 this . hooks . afterOptimizeChunks . call ( this . chunks , this . chunkGroups ) ;
32803278
3281- for ( const [
3282- name ,
3283- {
3284- options : { dependOn }
3285- }
3286- ] of this . entries ) {
3287- if ( dependOn ) {
3288- const entry = /** @type {Entrypoint } */ ( this . entrypoints . get ( name ) ) ;
3289- for ( const dep of dependOn ) {
3290- const depEntry = /** @type {Entrypoint } */ (
3291- this . entrypoints . get ( dep )
3292- ) ;
3293- const runtimeChunk = depEntry . getRuntimeChunk ( ) ;
3294- if ( runtimeChunk ) {
3295- runtimeChunk . addGroup ( entry ) ;
3296- }
3297- }
3298- }
3299- }
3300-
33013279 this . hooks . optimizeTree . callAsync ( this . chunks , this . modules , ( err ) => {
33023280 if ( err ) {
33033281 return finalCallback (
0 commit comments