Skip to content

Commit

Permalink
chore: don't server render if an error happens on static target
Browse files Browse the repository at this point in the history
  • Loading branch information
Atinux committed Feb 12, 2020
1 parent 37e4ba2 commit e23d3ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/vue-app/template/server.js
Expand Up @@ -102,6 +102,10 @@ export default async (ssrContext) => {
}
const renderErrorPage = async () => {
// Don't server-render the page in static target
if (ssrContext.target === 'static' || !ssrContext.res) {
ssrContext.nuxt.serverRendered = false
}
<% if (features.layouts) { %>
// Load layout for error page
const layout = (NuxtError.options || NuxtError).layout
Expand Down Expand Up @@ -247,10 +251,6 @@ export default async (ssrContext) => {

// ...If .validate() returned false
if (!isValid) {
// Don't server-render the page in generate mode
if (ssrContext.target === 'static') {
ssrContext.nuxt.serverRendered = false
}
// Render a 404 error page
return render404Page()
}
Expand Down

0 comments on commit e23d3ab

Please sign in to comment.