Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
586 views
in Technique[技术] by (71.8m points)

nuxt.js - How to setup Nuxt for an isomorphic universal app?

I was wondering how to use my Nuxt app into an isomorphic universal mode.
What I mean, is that I do want to use it with SSR and SPA at the same time.
I know that it can support both but I cannot see where to setup it properly.

I saw the mode property but I'm not sure to understand where to write it (in the nuxt.config.js file?).
Nor where to put the mode key.

Are mode: universal or mode: spa outdated?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

An image summing up all the different approaches can be found here: https://stackoverflow.com/a/63638062/8816585

mode is now deprecated as shown in the documentation

If you want to use your Nuxt app in an isomorphic (aka Universal) way, you need to have:

  • ssr: true
  • either target: server (default) or target: static

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...