inertiajs / inertia

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.
https://inertiajs.com
MIT License
6.56k stars 435 forks source link

[V2] SSR Error #2038

Closed ramonmalcolm10 closed 1 month ago

ramonmalcolm10 commented 1 month ago

Version:

Describe the problem:

Getting the following SSR error with Node and BUN runtime respectively

TypeError: Cannot read properties of undefined (reading 'default')
    at /node_modules/@inertiajs/react/dist/index.esm.js:1:1555
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at async z (/node_modules/@inertiajs/react/dist/index.esm.js:1:1574)
1 | import{router as ze}from"@inertiajs/core";import{router as he,setupProgress as ve}from"@inertiajs/core";import{createElement as Fe}from"react";import{createHeadManager as Pe,router as Y}from"@inertiajs/core";import{createElement as E,useEffect as ye,useMemo as Se,useState as Te}from"react";import{createContext as me}from"react";var J=me(void 0);J.displayName="InertiaHeadContext";var D=J;import{createContext as ge}from"react";var Q=ge(void 0);Q.displayName="InertiaPageContext";var O=Q;function w({children:l,initialPage:n,initialComponent:s,resolveComponent:a,titleCallback:i,onHeadUpdate:P}){let[c,m]=Te({component:s||null,page:n,key:null}),g=Se(()=>Pe(typeof window>"u",i||(f=>f),P||(()=>{})),[]);if(ye(()=>{Y.init({initialPage:n,resolveComponent:a,swapComponent:async({component:f,page:e,preserveState:u})=>{m(o=>({component:f,page:e,key:u?o.key:Date.now()}))}}),Y.on("navigate",()=>g.forceUpdate())},[]),!c.component)return E(D.Provider,{value:g},E(O.Provider,{value:c.page},null));let y=l||(({Component:f,props:e,ke

TypeError: undefined is not an object (evaluating 'S.default')
      at /node_modules/@inertiajs/react/dist/index.esm.js:1:1553

Steps to reproduce:

  1. Install Inertia React v2
  2. Set up SSR following the documentation