fix(vue-app): don't remove req/res/query unless in full static mode (#8611)

closes #7965
This commit is contained in:
Daniel Roe 2021-01-11 10:11:00 +00:00 committed by GitHub
parent 3bba4c6a7f
commit 71a3df8443
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -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)

View File

@ -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
}