diff --git a/lib/core/meta.js b/lib/core/meta.js index 8975894324..8264a506ab 100644 --- a/lib/core/meta.js +++ b/lib/core/meta.js @@ -45,7 +45,8 @@ export default class MetaRenderer { meta = { HTML_ATTRS: '', BODY_ATTRS: '', - HEAD: '' + HEAD: '', + BODY_SCRIPTS: '' } // Get vue-meta context const m = await this.getMeta(url) @@ -55,6 +56,8 @@ export default class MetaRenderer { meta.BODY_ATTRS = m.bodyAttrs.text() // HEAD tags meta.HEAD = m.meta.text() + m.title.text() + m.link.text() + m.style.text() + m.script.text() + m.noscript.text() + // BODY_SCRIPTS + meta.BODY_SCRIPTS = m.script.text({ body: true }) // Resources Hints meta.resourceHints = '' // Resource Hints diff --git a/lib/core/renderer.js b/lib/core/renderer.js index f9d0209e4d..cbf0ffe521 100644 --- a/lib/core/renderer.js +++ b/lib/core/renderer.js @@ -488,8 +488,8 @@ export default class Renderer { const ENV = this.options.env if (this.noSSR || spa) { - const { HTML_ATTRS, BODY_ATTRS, HEAD, resourceHints } = await this.metaRenderer.render(context) - const APP = `
${this.resources.loadingHTML}
` + const { HTML_ATTRS, BODY_ATTRS, HEAD, BODY_SCRIPTS, resourceHints } = await this.metaRenderer.render(context) + const APP = `
${this.resources.loadingHTML}
` + BODY_SCRIPTS // Detect 404 errors if (url.includes(this.options.build.publicPath) || url.includes('__webpack')) { @@ -528,6 +528,7 @@ export default class Renderer { } APP += `` APP += context.renderScripts() + APP += m.script.text({ body: true }) HEAD += context.renderStyles()