mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
parent
35c6ac411d
commit
82e4c2dc5f
@ -4,7 +4,7 @@ import { format } from 'util'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { TARGETS, urlJoin } from '@nuxt/utils'
|
import { TARGETS, urlJoin } from '@nuxt/utils'
|
||||||
import { parsePath, withoutTrailingSlash } from 'ufo'
|
import { decode, parsePath, withoutTrailingSlash } from 'ufo'
|
||||||
import devalue from '@nuxt/devalue'
|
import devalue from '@nuxt/devalue'
|
||||||
import { createBundleRenderer } from 'vue-server-renderer'
|
import { createBundleRenderer } from 'vue-server-renderer'
|
||||||
import BaseRenderer from './base'
|
import BaseRenderer from './base'
|
||||||
@ -210,7 +210,7 @@ export default class SSRRenderer extends BaseRenderer {
|
|||||||
// Page level payload.js (async loaded for CSR)
|
// Page level payload.js (async loaded for CSR)
|
||||||
const payloadPath = urlJoin(url, 'payload.js')
|
const payloadPath = urlJoin(url, 'payload.js')
|
||||||
const payloadUrl = urlJoin(staticAssetsBase, payloadPath)
|
const payloadUrl = urlJoin(staticAssetsBase, payloadPath)
|
||||||
const routePath = withoutTrailingSlash(parsePath(url).pathname)
|
const routePath = withoutTrailingSlash(decode(parsePath(url).pathname))
|
||||||
const payloadScript = `__NUXT_JSONP__("${routePath}", ${devalue({ data, fetch, mutations })});`
|
const payloadScript = `__NUXT_JSONP__("${routePath}", ${devalue({ data, fetch, mutations })});`
|
||||||
staticAssets.push({ path: payloadPath, src: payloadScript })
|
staticAssets.push({ path: payloadPath, src: payloadScript })
|
||||||
preloadScripts.push(payloadUrl)
|
preloadScripts.push(payloadUrl)
|
||||||
|
Loading…
Reference in New Issue
Block a user