Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt-Bridge RouteRules SSR settings not respected properly with nitro #1323

Closed
kevcodez opened this issue Oct 6, 2024 · 2 comments
Closed

Comments

@kevcodez
Copy link

kevcodez commented Oct 6, 2024

Environment

  • Operating System: Darwin
  • Node Version: v20.17.0
  • Nuxt Version: 2.18.1
  • CLI Version: 3.13.2
  • Nitro Version: 2.9.6
  • Package Manager: [email protected]
  • Builder: webpack
  • User Config: bridge, ssr, serverMiddleware, modern, telemetry, components, head, loading, router, css, plugins, buildModules, modules, sitemap, axios, sentry, build, publicRuntimeConfig, googleFonts, watchers, alias, serverHandlers, devServerHandlers, devServer, typescript, nitro
  • Runtime Modules: @nuxtjs/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], [email protected]
  • Build Modules: (), ~/modules/preload, @nuxtjs/[email protected], @nuxt/[email protected]

Reproduction

Nuxt-Bridge Link: https://codesandbox.io/p/devbox/nuxt-bridge-forked-cp5gr5?workspaceId=30220bd5-c136-4f9b-95b9-4ccf2a841fd5

Nuxt 3 Link (this works as expected!): https://codesandbox.io/p/devbox/nuxt3-playground-forked-8rdmhh

Describe the bug

When using nested dynamic routes routes with nuxt-bridge + nitro and setting ssr: false in the routeRules, it seems like this is not properly respected. I managed to get the child page to only be rendered on the client, but the parent layout in the nested dynamic route would still be rendered on the server, causing rendering issues as my page does not support SSR.

I have attached a reproduction link for both Nuxt-Bridge and Nuxt 3 - with Nuxt 3 everything works as expected and the page is only rendered on the client. In the Nuxt-Bridge example, the page is still rendered on the server (you can see the console logs in the Nuxt terminal logging false for process.client that is logged within the pages indicating a server-side render.

I would expect nuxt-bridge with Nitro to behave the same and fully respect the ssr setting from the routeRules and render this entire page (parent nested page + child page) on the client-side.

Additional context

No response

Logs

No response

@wattanx
Copy link
Collaborator

wattanx commented Oct 6, 2024

Currently the bridge only supports nitro.routeRules instead of routeRules.

nitro: {
  routeRules: {
    "/test/**": { ssr: false },
    "/test": { ssr: false },
  },
},

This seems to be working.
https://codesandbox.io/p/devbox/nuxt-bridge-forked-f47pjk

@kevcodez kevcodez closed this as completed Oct 6, 2024
@kevcodez
Copy link
Author

kevcodez commented Oct 6, 2024

@wattanx you're a life saver, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants