mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
404 routing for static export without exportPathMap (#5036)
Resolves #5035 Thanks a billion to @timneutkens for holding my hand
This commit is contained in:
parent
e0c74948d0
commit
b7fe234005
|
@ -31,6 +31,12 @@ export default async function (dir, options, configuration) {
|
||||||
if (page === '/_document' || page === '/_app') {
|
if (page === '/_document' || page === '/_app') {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (page === '/_error') {
|
||||||
|
defaultPathMap['404'] = { page }
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
defaultPathMap[page] = { page }
|
defaultPathMap[page] = { page }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,5 +48,10 @@ export default function (context) {
|
||||||
const $ = cheerio.load(html)
|
const $ = cheerio.load(html)
|
||||||
expect($('img').attr('src')).toBe('/static/myimage.png')
|
expect($('img').attr('src')).toBe('/static/myimage.png')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should render _error on 404', async () => {
|
||||||
|
const html = await renderViaHTTP(context.port, '/404')
|
||||||
|
expect(html).toMatch(/404/)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue