When using ssr: false (aka SPA-only), what are the benefits of Nuxt over Vue?
In nuxt.config.js
I have configured ssr: false
and I'm using some static hosting.
ssr: false
is CSR开发者_StackOverflow社区 (Client Side Rendering).
I wonder what is the difference between Nuxt and Vue in that case?
Nuxt's purpose is mainly SSG/SSR/Edge rendering (or anything tied to have your code coming from a server step at some point).
If you use ssr: false
, you will indeed lose a lot of Nuxt's strengths, meanwhile, you will still have:
- simple route creation with file-based rather than configuring a
router.js
file - automatic code-splitting of your routes
- the whole Nuxt modules ecosystem
- middlewares on the client side
- auto-imported components and Vue's
ref
,reactive
,onMounted
etc for you (if using Composition API) - cool data fetching capabilities (if using Composition API)
- automatic TS configuration (if using Nuxt3)
- [more benefits...]
As you can see, even if you use Nuxt as SPA-only, you will still get some quality of life improvements in your developer journey (better "DX").
Is it worth an abstraction on top of vanilla Vue? Maybe, depends on how fast/custom you want your code to be and if you don't feel like re-implementing the features already available in Nuxt.
精彩评论