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

atif-bashir-1998's avatar

Laravel 8 with Inertia Vue3 in SSR logs errors in the node server

I am using PHP 7.4, Laravel 8, Inertia with Vue3. I am following the steps mentioned in the documentation of Inertia.

I do not get any error while following the steps. But when I start the node server and laravel server and visit a page, I get the following error:

ReferenceError: document is not defined
    at insertStyleElement (/home/atif/Desktop/Practice/Larave-Breeze/example-app/public/js/ssr.js:2985:15)
    at addStyle (/home/atif/Desktop/Practice/Larave-Breeze/example-app/public/js/ssr.js:3100:13)
    at modulesToDom (/home/atif/Desktop/Practice/Larave-Breeze/example-app/public/js/ssr.js:2973:18)
    at module.exports (/home/atif/Desktop/Practice/Larave-Breeze/example-app/public/js/ssr.js:3131:25)
    at Object../node_modules/style-loader/dist/cjs.js!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-8.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-8.use[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/Pages/Welcome.vue?vue&type=style&index=0&id=317d1a6e&scoped=true&lang=css (/home/atif/Desktop/Practice/Larave-Breeze/example-app/public/js/ssr.js:2878:120)
    at __webpack_require__ (/home/atif/Desktop/Practice/Larave-Breeze/example-app/public/js/ssr.js:4447:41)
    at Object../resources/js/Pages/Welcome.vue?vue&type=style&index=0&id=317d1a6e&scoped=true&lang=css (/home/atif/Desktop/Practice/Larave-Breeze/example-app/public/js/ssr.js:4320:386)
    at __webpack_require__ (/home/atif/Desktop/Practice/Larave-Breeze/example-app/public/js/ssr.js:4447:41)
    at Object../resources/js/Pages/Welcome.vue (/home/atif/Desktop/Practice/Larave-Breeze/example-app/public/js/ssr.js:3673:126)
    at __webpack_require__ (/home/atif/Desktop/Practice/Larave-Breeze/example-app/public/js/ssr.js:4447:41)
ReferenceError: Cannot access '__WEBPACK_DEFAULT_EXPORT__' before initialization
    at Module.default (/home/atif/Desktop/Practice/Larave-Breeze/example-app/public/js/ssr.js:3669:42)
    at /home/atif/Desktop/Practice/Larave-Breeze/example-app/node_modules/@inertiajs/inertia-vue3/dist/index.js:1:9383
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
0 likes
0 replies

Please or to participate in this conversation.