404 routing for static export without exportPathMap (#5036)

Resolves #5035 

Thanks a billion to @timneutkens for holding my hand
This commit is contained in:
Kyle Holmberg 2018-08-27 03:28:54 -07:00 committed by Tim Neutkens
parent e0c74948d0
commit b7fe234005
2 changed files with 11 additions and 0 deletions

View file

@ -31,6 +31,12 @@ export default async function (dir, options, configuration) {
if (page === '/_document' || page === '/_app') {
continue
}
if (page === '/_error') {
defaultPathMap['404'] = { page }
continue
}
defaultPathMap[page] = { page }
}

View file

@ -48,5 +48,10 @@ export default function (context) {
const $ = cheerio.load(html)
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/)
})
})
}