mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
parent
631be3a1dd
commit
8e2d9764e2
@ -276,7 +276,7 @@ export default class Generator {
|
||||
// If crawler activated and called from generateRoutes()
|
||||
if (this.options.generate.crawler && this.options.render.ssr) {
|
||||
parse(html).querySelectorAll('a').map((el) => {
|
||||
const href = (el.getAttribute('href') || '').split('?')[0].split('#')[0].trim()
|
||||
const href = (el.getAttribute('href') || '').replace(/\/+$/, '').split('?')[0].split('#')[0].trim()
|
||||
|
||||
if (href.startsWith('/') && !path.extname(href) && this.shouldGenerateRoute(href) && !this.generatedRoutes.has(href)) {
|
||||
this.generatedRoutes.add(href) // add the route to the tracked list
|
||||
|
@ -303,7 +303,7 @@ export default {
|
||||
this._payloadFetchIndex = 0
|
||||
},
|
||||
async fetchPayload(route) {
|
||||
route = (route.replace(/\/$/, '') || '/').split('?')[0]
|
||||
route = (route.replace(/\/+$/, '') || '/').split('?')[0]
|
||||
try {
|
||||
const src = urlJoin(window.__NUXT_STATIC__, route, 'payload.js')
|
||||
const payload = await window.__NUXT_IMPORT__(route, src)
|
||||
|
@ -185,7 +185,8 @@ export default class SSRRenderer extends BaseRenderer {
|
||||
// Page level payload.js (async loaded for CSR)
|
||||
const payloadPath = urlJoin(url, 'payload.js')
|
||||
const payloadUrl = urlJoin(staticAssetsBase, payloadPath)
|
||||
const payloadScript = `__NUXT_JSONP__("${url}", ${devalue({ data, fetch })});`
|
||||
const routePath = (url.replace(/\/+$/, '') || '/').split('?')[0] // remove trailing slah and query params
|
||||
const payloadScript = `__NUXT_JSONP__("${routePath}", ${devalue({ data, fetch })});`
|
||||
staticAssets.push({ path: payloadPath, src: payloadScript })
|
||||
preloadScripts.push(payloadUrl)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user