Skip to content

Commit

Permalink
Ensure react loadable manifest includes all needed requests
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Jan 16, 2021
1 parent cdab7bf commit bc69764
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/next/build/webpack/plugins/react-loadable-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,29 @@ function buildManifest(
}
})
})

// ensure all requests are included even if no nested chunks
if (!manifest[request]) {
const requestDependency = chunkGroupOrigin.module.blocks.find(
(block: any) => block.request === request
).dependencies[0]

let requestId

if (isWebpack5) {
// @ts-ignore
requestId = compilation.moduleGraph.getModule(requestDependency).id
} else {
requestId = requestDependency.module.id
}

manifest[request] = [
{
id: requestId,
file: requestId,
},
]
}
})
})

Expand Down

0 comments on commit bc69764

Please sign in to comment.