Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
551 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 Reply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...