Nuxt.js: Does nuxtServerInit work in spa mode?

Created on 23 Sep 2017  路  3Comments  路  Source: nuxt/nuxt.js

I have been trying to get nuxtServerInit to work for an hour now. it is never called. Is it because i use SPA mode?

This question is available on Nuxt.js community (#c1537)

Most helpful comment

@alexchopin I ended up following your advise from here and that helped a lot. It will be extremely useful to add that to FAQ. Also need to mention/clarify in nuxtserverinit doc that it only works on serverside.

https://github.com/nuxt/nuxt.js/issues/240#issuecomment-326893386

Thanks

All 3 comments

@husayt it does not. I believe nuxtClientInit is in the works.

In the mean time, my solution was to create a middleware that gets run. Not sure if it'll fit your needs but worth a shot.

Also, it has been suggested that you can create a nextClientInit plugin, that also functions the same. I do however question, how you can ensure this plugin runs first before others and may run into a race condition against plugins.

@alexchopin I ended up following your advise from here and that helped a lot. It will be extremely useful to add that to FAQ. Also need to mention/clarify in nuxtserverinit doc that it only works on serverside.

https://github.com/nuxt/nuxt.js/issues/240#issuecomment-326893386

Thanks

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maicong picture maicong  路  3Comments

bimohxh picture bimohxh  路  3Comments

msudgh picture msudgh  路  3Comments

nassimbenkirane picture nassimbenkirane  路  3Comments

vadimsg picture vadimsg  路  3Comments