vuejs3server-side-renderingnuxt3.jsclient-side-rendering

Nuxt 3 routeRules for disabling SSR only for one page


I have a Vue 3 with Nuxt 3 application.

My folder structure is like this with pages folder being in the root:

-- pages/
   -- games/
      -- skills/
         -- [player].vue
   -- more-pages/

In my nuxt.config.ts file I have a property for routeRules and I want this changed only for one page for hybrid rendering by disabling the SSR. Currently, I have it as below:

export default defineNuxtConfig({
  routeRules: {
    "/pages/games/skills/**": { ssr: false },
  },
})

I want to disable SSR only for the [player].vue page. Should the routeRules for the page path be as above

OR should it be as below, i.e., not to explicitly mention the /pages folder?

export default defineNuxtConfig({
  routeRules: {
    "/games/skills/**": { ssr: false },
  },
})

Solution

  • Without /pages.

    That is just the folder containing the route / path, not part of it.