You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportdefaultserver$(async(path: string)=>{// Do stuff});
Produces:
An error occured while server rendering /program/33740:
Error: Should be compiled away
at Module.server$ [as default] (/Users/jchatard/Documents/XXXX/XXXX.fr/front-solidjs/node_modules/.pnpm/solid-start@0.2.5_hbwrjiud3j45e6mxm6q434ty3e/node_modules/solid-start/server/server-functions/server.ts:21:8)
at /Users/jchatard/Documents/XXXX/XXXX.fr/front-solidjs/src/lib/fetcher.ts:14:23
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async instantiateModule (file:///Users/jchatard/Documents/XXXX/XXXX.fr/front-solidjs/node_modules/.pnpm/vite@3.2.3/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:53053:9
But this works:
exportconstfetchAPI=()=>server$(async(path: string)=>{// Do stuff});
Works!
The text was updated successfully, but these errors were encountered:
To give an update, I have been struggling to make it work in my full app, until I stumbled accross this comment from @nksaraf on Discord:
Yeah this is very fair... since its only me who has worked on it and used it extensively.. subconciously I know what to do.. one thing to look out for it to make sure the files are .tsx when you use server functions since that can cause the compiled error thing
So renaming files which contained server$calls from *.ts to *.tsx, solved my issue.
ryansolid
changed the title
server$ can't be exported as default
server$ should work in not only .jsx and .tsx files
Dec 21, 2022
Using
server$
as default export breaks build.Produces:
But this works:
Works!
The text was updated successfully, but these errors were encountered: