mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This fixes the issue that build error is not cleared correctly during `next dev` even if the build succeeds, and we have to re-run `next dev` to make it work. It appears only when: 1. page runtime is `edge` 2. use webpack hot reloader 3. import components in the `edge` page Reproduction: https://github.com/pacexy/nextjs-edge-webpack-hmr-reproduction I recorded a screenshot to make it easier to understand: https://github.com/vercel/next.js/assets/32255488/0ddc21bf-2ea7-49ce-b682-c89dea757c61 Closes NEXT-2168 --------- Co-authored-by: Jiachi Liu <[email protected]>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { createNextDescribe } from 'e2e-utils'
|
|
import { hasRedbox } from 'next-test-utils'
|
|
|
|
createNextDescribe(
|
|
'develop - app-dir - edge errros hmr',
|
|
{
|
|
files: __dirname,
|
|
},
|
|
({ next }) => {
|
|
it('should recover from build errors when server component error', async () => {
|
|
const browser = await next.browser('/')
|
|
const clientComponentSource = await next.readFile('app/comp.server.js')
|
|
|
|
await next.patchFile('app/comp.server.js', (content) => {
|
|
return content.replace('{/* < */}', '<') // uncomment
|
|
})
|
|
|
|
expect(await hasRedbox(browser)).toBe(true)
|
|
|
|
await next.patchFile('app/comp.server.js', clientComponentSource)
|
|
|
|
expect(await hasRedbox(browser)).toBe(false)
|
|
})
|
|
|
|
it('should recover from build errors when client component error', async () => {
|
|
const browser = await next.browser('/')
|
|
const clientComponentSource = await next.readFile('app/comp.client.js')
|
|
|
|
await next.patchFile('app/comp.client.js', (content) => {
|
|
return content.replace('{/* < */}', '<') // uncomment
|
|
})
|
|
|
|
expect(await hasRedbox(browser)).toBe(true)
|
|
|
|
await next.patchFile('app/comp.client.js', clientComponentSource)
|
|
|
|
expect(await hasRedbox(browser)).toBe(false)
|
|
})
|
|
}
|
|
)
|