Fix trace when initial file is also child (#30048)
* Fix trace when initial file is also child * update page count test
This commit is contained in:
parent
b794c171f2
commit
afbb56363b
3 changed files with 37 additions and 2 deletions
|
@ -327,7 +327,11 @@ export class TraceEntryPointsPlugin implements webpack.Plugin {
|
|||
for (const file of fileList!) {
|
||||
const reason = reasons!.get(file)
|
||||
|
||||
if (!reason || reason.type === 'initial' || !reason.parents) {
|
||||
if (
|
||||
!reason ||
|
||||
!reason.parents ||
|
||||
(reason.type === 'initial' && reason.parents.size === 0)
|
||||
) {
|
||||
continue
|
||||
}
|
||||
propagateToParents(reason.parents, file)
|
||||
|
|
13
test/integration/production/pages/client-error.js
Normal file
13
test/integration/production/pages/client-error.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import Link from 'next/link'
|
||||
import Error from 'next/error'
|
||||
|
||||
export default function Page(props) {
|
||||
return (
|
||||
<>
|
||||
<Error title="something went wrong (on purpose)" />
|
||||
<Link href="/">
|
||||
<a>to home</a>
|
||||
</Link>
|
||||
</>
|
||||
)
|
||||
}
|
|
@ -58,7 +58,7 @@ describe('Production Usage', () => {
|
|||
})
|
||||
|
||||
it('should contain generated page count in output', async () => {
|
||||
const pageCount = 39
|
||||
const pageCount = 40
|
||||
expect(output).toContain(`Generating static pages (0/${pageCount})`)
|
||||
expect(output).toContain(
|
||||
`Generating static pages (${pageCount}/${pageCount})`
|
||||
|
@ -79,6 +79,22 @@ describe('Production Usage', () => {
|
|||
],
|
||||
notTests: [/node_modules\/react\/cjs\/react\.development\.js/],
|
||||
},
|
||||
{
|
||||
page: '/client-error',
|
||||
tests: [
|
||||
/webpack-runtime\.js/,
|
||||
/chunks\/.*?\.js/,
|
||||
/node_modules\/react\/index\.js/,
|
||||
/node_modules\/react\/package\.json/,
|
||||
/node_modules\/react\/cjs\/react\.production\.min\.js/,
|
||||
/next\/link\.js/,
|
||||
/next\/dist\/client\/link\.js/,
|
||||
/next\/dist\/shared\/lib\/router\/utils\/resolve-rewrites\.js/,
|
||||
/next\/dist\/pages\/_error\.js/,
|
||||
/next\/error\.js/,
|
||||
],
|
||||
notTests: [/node_modules\/react\/cjs\/react\.development\.js/],
|
||||
},
|
||||
{
|
||||
page: '/dynamic',
|
||||
tests: [
|
||||
|
@ -110,6 +126,8 @@ describe('Production Usage', () => {
|
|||
notTests: [
|
||||
/node_modules\/react\/cjs\/react\.development\.js/,
|
||||
/node_modules\/nanoid\/index\.cjs/,
|
||||
/next\/dist\/pages\/_error\.js/,
|
||||
/next\/error\.js/,
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue