Skip to content

server$ should work in not only .jsx and .tsx files #408

@jchatard

Description

@jchatard

Using server$ as default export breaks build.

export default server$(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:

export const fetchAPI = () => server$(async (path: string) => {
  // Do stuff
}); 

Works!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions