How to implement SSR for single vue component inside of laravel application?

Ale*_*pov 6 laravel vue.js server-side-rendering

I'm working on an laravel project. There're a lot of vue components and I need to make SSR due to SEO. I can't use nuxt.js or something like it because of my app is not SPA. I have default mix settings:

const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.sass', 'public/css');
mix.disableSuccessNotifications();
Run Code Online (Sandbox Code Playgroud)

I put the vue components to laravel views (blade templates) like <example-component></example-component>. How may I implement SSR for there components only in this case?

I need to add this components as rendered html to the response, not as <example-component></example-component> due to SEO.

Fla*_*ame 0

当前的解决方案需要使用 Node,或者在极端情况下需要 PHP 与 V8Js 引擎相结合。

请参阅https://ssr.vuejs.org/guide/#integrating-with-a-server以帮助您入门。vue-server-renderer基于预先呈现 HTML 的 Node/express.js 实现。

我还没有尝试过任何基于 PHP 的解决方案,不幸的是这是我目前可以给您的最佳答案。