Unverified Commit 864d401e authored by await-ovo's avatar await-ovo Committed by GitHub

fix(next): use moduleGraph.getIssuer to avoid deprecation warning (#36329) (#36330)

fix: #36329 



## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
parent 9456fc6b
...@@ -106,12 +106,16 @@ const matchNextPageBundleRequest = route( ...@@ -106,12 +106,16 @@ const matchNextPageBundleRequest = route(
) )
// Recursively look up the issuer till it ends up at the root // Recursively look up the issuer till it ends up at the root
function findEntryModule(issuer: any): any { function findEntryModule(
if (issuer.issuer) { compilation: webpack5.Compilation,
return findEntryModule(issuer.issuer) issuerModule: any
): any {
const issuer = compilation.moduleGraph.getIssuer(issuerModule)
if (issuer) {
return findEntryModule(compilation, issuer)
} }
return issuer return issuerModule
} }
function erroredPages(compilation: webpack5.Compilation) { function erroredPages(compilation: webpack5.Compilation) {
...@@ -121,7 +125,7 @@ function erroredPages(compilation: webpack5.Compilation) { ...@@ -121,7 +125,7 @@ function erroredPages(compilation: webpack5.Compilation) {
continue continue
} }
const entryModule = findEntryModule(error.module) const entryModule = findEntryModule(compilation, error.module)
const { name } = entryModule const { name } = entryModule
if (!name) { if (!name) {
continue continue
......
import { createNext } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { renderViaHTTP } from 'next-test-utils'
describe('webpack-issuer-deprecation-warning', () => {
let next: NextInstance
beforeAll(async () => {
next = await createNext({
files: {
'pages/index.js': `
export default function Page() {
return <p>hello world
}
`,
},
dependencies: {},
})
})
afterAll(() => next.destroy())
it('should not appear deprecation warning about webpack module issuer', async () => {
const html = await renderViaHTTP(next.url, '/')
expect(html).toContain('Syntax Error')
expect(next.cliOutput).not.toContain(
'[DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API'
)
})
})
...@@ -40,6 +40,8 @@ export class NextDevInstance extends NextInstance { ...@@ -40,6 +40,8 @@ export class NextDevInstance extends NextInstance {
}, },
}) })
this._cliOutput = ''
this.childProcess.stdout.on('data', (chunk) => { this.childProcess.stdout.on('data', (chunk) => {
const msg = chunk.toString() const msg = chunk.toString()
process.stdout.write(chunk) process.stdout.write(chunk)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment