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: enable Vue SSR using the latest Vite Ruby and Inertia.js versions #5

Merged
merged 3 commits into from
May 13, 2022

Conversation

ElMassimo
Copy link
Owner

@ElMassimo ElMassimo commented May 13, 2022

Description 📖

This pull request enables server-side rendering the Vue app using:

Step by step

  • Used Inertia.configure to set ssr_enabled = true in production
  • Added @inertiajs/server and vue-server-renderer packages
  • Extracted the creation of the Inertia app, checking if el is available in setup to mount the app when not in SSR
  • Leveraged import.meta.env.SSR to make the app code compatible with both Node.js and browsers
    • And using mounted instead of created for code that should not run in Node.js
@ElMassimo ElMassimo merged commit bc8b0d6 into main May 13, 2022
@ElMassimo ElMassimo deleted the ssr branch May 13, 2022 03:04
</head>

<body class="font-sans leading-none text-gray-800 antialiased">
<noscript>
<p>We're sorry but PingCRM doesn't work properly without JavaScript enabled. Please enable it to continue.</p>
</noscript>
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

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