Nuxt.js static site and 404 page
No answers received.
I removed the pages/404.vue
in the end and created it as layouts/error.vue
error.vue was giving me erros related to default.vue, for some reasons, so I created a layouts/basic.vue
layout as an (almost) empty container for error.vue.
The error page now works during dev and during the new nuxt start local testing on full static site (since nuxt 2.13), but still not on the live site, which I will check if related to server settings.
the above goes together with generate: { fallback: true }
in nuxt.config.js (which creates the 404.html page)
In order to generate a 404 fallback page in nuxt.js you need to first set the generate option in your nuxt.config.js like this
generate: { fallback: '404.html' }
Then you need to create a new layout called error.vue in your layouts directory
layouts/error.vue
After you have done this you can nuxt generate
followed by nuxt start
to run your project with a fallback page for the 404 error.