diff --git a/packages/vue-app/template/server.js b/packages/vue-app/template/server.js index 0fe341f0a3..5beb11fb55 100644 --- a/packages/vue-app/template/server.js +++ b/packages/vue-app/template/server.js @@ -80,9 +80,11 @@ export default async (ssrContext) => { <% } %> // Remove query from url is static target - if (process.static && ssrContext.url) { + <% if (isFullStatic) { %> + if (ssrContext.url) { ssrContext.url = ssrContext.url.split('?')[0] } + <% } %> // Public runtime config ssrContext.nuxt.config = ssrContext.runtimeConfig.public // Create the app definition and the instance (created for each request) diff --git a/packages/vue-app/template/utils.js b/packages/vue-app/template/utils.js index ad54b9650f..d156f77817 100644 --- a/packages/vue-app/template/utils.js +++ b/packages/vue-app/template/utils.js @@ -184,12 +184,14 @@ export async function setContext (app, context) { env: <%= JSON.stringify(env) %><%= isTest ? '// eslint-disable-line' : '' %> } // Only set once - if (!process.static && context.req) { + <% if (!isFullStatic) { %> + if (context.req) { app.context.req = context.req } - if (!process.static && context.res) { + if (context.res) { app.context.res = context.res } + <% } %> if (context.ssrContext) { app.context.ssrContext = context.ssrContext }