[Vuejs]-NuxtServerInit in Modules mode does not run

0👍

As it says in the documentation, you really need to have that function in the index.js file inside the store folder, which will not work otherwise.

here’s an example of a production NuxtJs universal application with the ./store/index.js only with that file, you can easily call other stores methods by prefixing them with the file name, as the example shows auth/setAuth

enter image description here

0👍

I just faced the problem that nuxtServerInit was not called. The reason was in nuxt.config.js where ssr was set to false.

nuxt.config.js

export default {
  // Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
  // ssr: false,  <-- Remove or out comment the line

  /*
   ** Nuxt target
   ** See https://nuxtjs.org/api/configuration-target
   */
  target: 'server',

  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
  }
}

Leave a comment