Skip to content

Commit

Permalink
fix: crash on using $nuxtI18nHead from nuxt.config's head
Browse files Browse the repository at this point in the history
Fixes #1266
  • Loading branch information
rchl committed Aug 30, 2021
1 parent cd44eb5 commit 158c390
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/templates/plugin.routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ const VueInstanceProxy = function (targetFunction) {
localePath: this.localePath,
localeRoute: this.localeRoute,
localeLocation: this.localeLocation,
req: process.server ? this.$ssrContext.req : null,
// @ts-ignore
req: process.server ? this.$root.context?.req || this.$ssrContext?.req : null,
route: this.$route,
router: this.$router,
store: this.$store
Expand Down
6 changes: 5 additions & 1 deletion test/fixture/basic/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import BaseConfig from '../base.config'
const config = {
...BaseConfig,
buildDir: resolve(__dirname, '.nuxt'),
srcDir: __dirname
srcDir: __dirname,
// Verifies that there is no SSR crash when used that way.
head () {
return this.$nuxtI18nHead({ addSeoAttributes: true })
}
}

module.exports = config

0 comments on commit 158c390

Please sign in to comment.