I have a custom 404 page for my Nextjs app. I wanted to try the build project locally before deploying it to server. I used the "serve" package to host the project locally. The project loads fine but when I tried to navigate to a page that doesn't exist, the app uses the default 404 page and not the customized one. I just want to ask if there are needed steps to configure in order to run the custom 404 page from Next.js or if it is possible to load the custom 404 page locally.
In the browser:
404.tsx file:
next.config file:
module.exports = {
trailingSlash: true,
webpack: (config, options) => {
config.module.rules.push({
test: /\.(html)$/,
use: {
loader: 'html-loader',
},
})
return config
},
}
404.tsx
export default function FourOhFour() {
return <>
<h1>404 - Page Not Found - Test 404 Page</h1>
</>
}


fallback: trueingetStaticPaths, although the docs are a bit misleading here, IMO: data-fetching/get-static-paths#fallback-true.