dogma's avatar
Level 1

SSR and dynamic javascript package loading

Hello Laravel Masters,

I am using

I am trying to achieve the following:

I want to use ssr and have a vue component that uses the SplideJS - vue package. This package shouldn't load with ssr, since it dynamically adapts to screensizes etc. I just want it to skip loading in ssr and beeing hydrated only clientside.

My attempts:

"ignoring it in the vite.config.mjs via "external" and "isCustomElement"

My main.js file

My ssr.js

In my component I tried:

When I start the inertia-ssr server via php artisan inertia:start-ssr no error is received except in my firefox console:

[Vue warn]: Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`. 
Component that was made reactive:  
Object { name: "Splide", emits: (27) […], components: {…}, props: {…}, setup: setup(props, context), render: _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options)
 }
 
  at <CCustomerService> 
  at <BasicStoreLayout> 

I am building via "build": "vite build && vite build --ssr".

Everything works fine without ssr. Right now it is sliding too, but isn't responsive at all + the error is confusing me. I copied a lot of code from a fresh laravel project but unfortunately there's not a lot of docu about "disable packages for ssr"

Any ideas?

0 likes
1 reply
dogma's avatar
dogma
OP
Best Answer
Level 1

Solved it via:

Please or to participate in this conversation.