Skip to content Skip to sidebar Skip to footer

Can We Combine The Spa Concept With Dynamic Nested Routes In Nuxt.js?

In my Nuxt.js application, I have to use dynamic nested routes. This means I will end up by having various HTML files generated. The problem is that I must embed my whole applicati

Solution 1:

These concepts are not mutually exclusive, you only need to set the nuxt.conf.js mode into 'spa' and you can leave everything else in place.

As per the official documentation:

So, for an SPA deployment, you must do the following:

  • Change mode in nuxt.config.js to spa.
  • Run npm run build.
  • Deploy the created dist/ folder to your static hosting like Surge, GitHub Pages or nginx.

without any further configuration you should be set to deploy your app.

Also note this:

nuxt generate still needs SSR engine during build/generate time while having the advantage of having all our pages pre rendered, and have a high SEO and page load score. The content is generated at build time. For example, we can't use it for applications where content depends on user authentication or a real time API (at least for the first load).

This means that you need to generate your page in an environment where the ssr tools are installed.

Also the next parragraph

Solution 2:

I confirm that we combine SPA and dynamic nested routes. All what to do is to declare the dynamic routes within nuxt.config.js file and set: mode: 'spa'

Post a Comment for "Can We Combine The Spa Concept With Dynamic Nested Routes In Nuxt.js?"