Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shariff's avatar
Level 50

How to convert a Vue inertia app to Vue inertia SSR app?

Hi

A SPA website was developed with Laravel + inertia vue. It is working fine and in production. The version is as follows

"@inertiajs/inertia": "^0.9.2",
"@inertiajs/inertia-vue": "^0.6.2",
 "@inertiajs/progress": "^0.2.5",
 "vue": "^2.6.11",
"vue-meta": "^2.4.0",
"vuex": "^3.6.2"
"laravel-mix": "^5.0.1",

The website is not SEO-friendly. Hence, I wanted to change this website to SSR. Here is the link I followed to change it https://inertiajs.com/server-side-rendering. However, after installing new packages and setting up the website, it does not work anymore. I don't know whether what I'm doing is right or wrong.

Is it possible to convert an existing website to SSR or should a new project be created?

Thank you

0 likes
10 replies
Sinnbeck's avatar

No you should just be able to convert it. So if it isnt working, you need to tell us how it isnt working if we are to help you

shariff's avatar
Level 50

@sinnbeck whenever I'm installing the packages vue-server-renderer and @inertiajs/server. It told me to update the @inertiajs/inertia package to latest verision. After upgrading to latest versions. I am getting error as props are undefined. Not able to compile ssr.js file. I'll post the error log

shariff's avatar
Level 50

@sinnbeck My after upgrading my latest package.json file

"@inertiajs/inertia": "^0.11.1",
 "@inertiajs/inertia-vue": "^0.8.0",
 "@inertiajs/server": "^0.1.0",
"vue-server-renderer": "^2.7.13",
"webpack-node-externals": "^3.0.0",
 "vue": "^2.6.11",
"vuex": "^3.6.2",

in console

Uncaught ReferenceError: route is not defined
    at ./resources/themes/cake/assets/js/app.js (app.js:sourcemap:104036:63)
    at __webpack_require__ (app.js:sourcemap:20:30)
    at 0 (app.js:sourcemap:104164:1)
    at __webpack_require__ (app.js:sourcemap:20:30)
    at app.js:sourcemap:84:18
    at app.js:sourcemap:87:10

In browser I can see only

@inertiaHead

whenever I'm trying to compile webpack.ssr.js file using npx mix --mix-config=webpack.ssr.mix.js

TypeError: mix.options(...).js is not a function
    at Object.<anonymous> (C:\xampp\htdocs\a1cakes\webpack.ssr.mix.js:7:6)
    at Module._compile (C:\xampp\htdocs\a1cakes\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)

shariff's avatar
Level 50

@Sinnbeck Okay, thanks for the link. Can I update vue and laravel-mix to latest version?

Sinnbeck's avatar

@shariff I dont use vue so I dont know if your code will be compatible if you upgrade to vue 3

piaoyilong114's avatar

@Sinnbeck bro, I have laravel vuetify vuex project. I need to change to innertia vue for ssr what is fast solution? I am migrating pages step by step but not sure how to make routing part because innertia use laravel route but currently project is using vue routing

Yousef_'s avatar

@shariff did you find the solution ? cuz i also have this problem, but for me i already use vite with laravel 10 and breeze ssr , so please share the solution with me:

ReferenceError: route is not defined at setup (file:///C:/laragon/www/cons-taafi/bootstrap/ssr/assets/Login-affce277.js:32:18) at _sfc_main.setup (file:///C:/laragon/www/cons-taafi/bootstrap/ssr/assets/Login-affce277.js:498:23) at callWithErrorHandling (C:\laragon\www\cons-taafi\node_modules\@vue\runtime-core\dist\runtime-core.cjs.js:156:18) at setupStatefulComponent (C:\laragon\www\cons-taafi\node_modules\@vue\runtime-core\dist\runtime-core.cjs.js:7190:25) at setupComponent (C:\laragon\www\cons-taafi\node_modules\@vue\runtime-core\dist\runtime-core.cjs.js:7151:36) at renderComponentVNode (C:\laragon\www\cons-taafi\node_modules\@vue\server-renderer\dist\server-renderer.cjs.js:614:15) at renderVNode (C:\laragon\www\cons-taafi\node_modules\@vue\server-renderer\dist\server-renderer.cjs.js:743:14) at renderComponentSubTree (C:\laragon\www\cons-taafi\node_modules\@vue\server-renderer\dist\server-renderer.cjs.js:698:7) at renderComponentVNode (C:\laragon\www\cons-taafi\node_modules\@vue\server-renderer\dist\server-renderer.cjs.js:631:12) at renderVNode (C:\laragon\www\cons-taafi\node_modules\@vue\server-renderer\dist\server-renderer.cjs.js:743:14)

Please or to participate in this conversation.