Add test case for #48583 and ignore hot-update scripts (#48587)

Add a test case for #48583.
This commit is contained in:
Shu Ding 2023-04-20 16:32:31 +02:00 committed by GitHub
parent acd3b25ef5
commit ebddbf1b00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 0 deletions

View file

@ -263,6 +263,8 @@ export class ClientReferenceManifestPlugin {
// It's possible that a chunk also emits CSS files, that will
// be handled separatedly.
if (!file.endsWith('.js')) return null
if (file.endsWith('.hot-update.js')) return null
return requiredChunk.id + ':' + file
})
})

View file

@ -0,0 +1,5 @@
'use client'
export default function () {
return <h1>hello</h1>
}

View file

@ -0,0 +1,11 @@
// This file is needed for the test, to ensure that the "comp.js" module is
// created as a dynamic import chunk.
'use client'
export default function Page() {
import('./comp').then((m) => {
console.log(m)
})
return null
}

View file

@ -0,0 +1,5 @@
import Comp from '../comp'
export default function Page() {
return <Comp />
}

View file

@ -52,5 +52,10 @@ createNextDescribe(
await browser.elementByCss('#css-text-dynamic-no-ssr-client').text()
).toBe('next-dynamic dynamic no ssr on client:suffix')
})
it('should generate correct client manifest for dynamic chunks', async () => {
const $ = await next.render$('/chunk-loading/server')
expect($('h1').text()).toBe('hello')
})
}
)