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

feat(vite-plugin-nitro): add support for conditional server rendering at runtime #1623

Merged
merged 6 commits into from
Feb 25, 2025

Conversation

brandonroberts
Copy link
Member

PR Checklist

Closes #

What is the new behavior?

Current, you can fully opt-in or opt-out of SSR. This change allows you to specify certain routes that should only be rendered client side, and are not to be server rendered at runtime. This also allows you to render additional pages such as a 404.html page when deploying an SPA.

import { defineConfig } from 'vite';
import analog from '@analogjs/platform';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
  // ...other config
  plugins: [
    analog({
      prerender: {
        routes: ['/', '/404.html'],
      },
      nitro: {
        routeRules: {
          // All admin URLs are only rendered on the client
          '/admin/**': { ssr: false },

          // Render a /404.html page as a fallback for SPAs
          '/404.html': { ssr: false },
        },
      },
    }),
  ],
}));

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

[optional] What gif best describes this PR or how it makes you feel?

Copy link

netlify bot commented Feb 25, 2025

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit 91c24c1
🔍 Latest deploy log https://app.netlify.com/sites/analog-app/deploys/67be1a2f04d7420008e85a43
😎 Deploy Preview https://deploy-preview-1623--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 25, 2025

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit 91c24c1
🔍 Latest deploy log https://app.netlify.com/sites/analog-docs/deploys/67be1a2fd1ce42000820a7da
😎 Deploy Preview https://deploy-preview-1623--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 25, 2025

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit 91c24c1
🔍 Latest deploy log https://app.netlify.com/sites/analog-blog/deploys/67be1a2f1400ad00088ad366
😎 Deploy Preview https://deploy-preview-1623--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 25, 2025

Deploy Preview for analog-ng-app ready!

Name Link
🔨 Latest commit 91c24c1
🔍 Latest deploy log https://app.netlify.com/sites/analog-ng-app/deploys/67be1a2f8dc3010008c8a4f7
😎 Deploy Preview https://deploy-preview-1623--analog-ng-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@brandonroberts brandonroberts changed the title feat(vite-plugin-nitro): add support for conditional server rendering at runtimx feat(vite-plugin-nitro): add support for conditional server rendering at runtime Feb 25, 2025
@brandonroberts brandonroberts merged commit fa81e94 into beta Feb 25, 2025
24 checks passed
@brandonroberts brandonroberts deleted the feat-runtime-no-ssr branch February 25, 2025 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant