Static GitHub Issues

[3301] Pass `context` instead of `context.nuxt` at `render:context` hook

prev: Add nuxt.renderRequest()
next: Head meta in pages not working first load!

What problem does this feature solve?

You can get a request data at render:context hook.

module.exports = function LogModule (moduleOptions) {
  this.nuxt.hook('render:context', (context) => {
    console.log(context.req.url)
    console.dir(context.nuxt)
  })
}

What does the proposed changes look like?

https://github.com/nuxt/nuxt.js/blob/7514db73b25c23b8c14ebdafbb4e129ac282aabd/lib/core/renderer.js#L352-L360

    if (this.options.render.resourceHints) {
      HEAD += context.renderResourceHints()
    }

    await this.nuxt.callHook('render:context', context)

    const serializedSession = `window.__NUXT__=${serialize(context.nuxt, {
      isJSON: true
    })};`
<!--cmty--><div align="right"><sub><em>This feature request is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c7023">#c7023</a>)</em></sub></div>