From 1ff01134da3aa07d3517da45f65a0a3a1869a232 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Wed, 11 May 2022 14:09:07 +0800 Subject: [PATCH] fix(#30300): force export 404.html --- packages/next/export/worker.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/next/export/worker.ts b/packages/next/export/worker.ts index e8db5c26e467..28eab497d3bd 100644 --- a/packages/next/export/worker.ts +++ b/packages/next/export/worker.ts @@ -221,8 +221,13 @@ export default async function exportPage({ // extension of `.slug]` const pageExt = isDynamic ? '' : extname(page) const pathExt = isDynamic ? '' : extname(path) + + // force output 404.html for backwards compat + if (path === '/404.html') { + htmlFilename = path + } // Make sure page isn't a folder with a dot in the name e.g. `v1.2` - if (pageExt !== pathExt && pathExt !== '') { + else if (pageExt !== pathExt && pathExt !== '') { const isBuiltinPaths = ['/500', '/404'].some( (p) => p === path || p === path + '.html' )