Skip to content

Commit

Permalink
fix(next): use moduleGraph.getIssuer to avoid deprecation warning (ve…
Browse files Browse the repository at this point in the history
  • Loading branch information
await-ovo committed Apr 21, 2022
1 parent 5a93e21 commit c25bcad
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/next/server/dev/hot-reloader.ts
Expand Up @@ -106,12 +106,16 @@ const matchNextPageBundleRequest = route(
)

// Recursively look up the issuer till it ends up at the root
function findEntryModule(issuer: any): any {
if (issuer.issuer) {
return findEntryModule(issuer.issuer)
function findEntryModule(
compilation: webpack5.Compilation,
issuerModule: any
): any {
const issuer = compilation.moduleGraph.getIssuer(issuerModule)
if (issuer) {
return findEntryModule(compilation, issuer)
}

return issuer
return issuerModule
}

function erroredPages(compilation: webpack5.Compilation) {
Expand All @@ -121,7 +125,7 @@ function erroredPages(compilation: webpack5.Compilation) {
continue
}

const entryModule = findEntryModule(error.module)
const entryModule = findEntryModule(compilation, error.module)
const { name } = entryModule
if (!name) {
continue
Expand Down

0 comments on commit c25bcad

Please sign in to comment.