TanStackT
TanStack2mo ago
1 reply
brilliant-lime

Static Server Function Cloudflare Worker

I'm trying to use a static server function in my start app, like this:
const $homePageInfo = createServerFn({ method: 'GET' })
  .middleware([staticFunctionMiddleware])
  .handler(async () => {
    const homePage = await runQuery(homePageQuery);
    return homePage;
  })


this works fine during dev, but when i build I get this:
Error: [unenv] fs.mkdir is not implemented yet!


This is my vite config:
export default defineConfig({
  server: {
    port: 3000,
  },
  plugins: [
    cloudflare({ viteEnvironment: { name: "ssr" } }),
    tsConfigPaths({
      projects: ["./tsconfig.json"],
    }),
    tanstackStart({
       prerender: {
        crawlLinks: true,
        enabled: true,
      },
      sitemap: {
        host: "site.com"
      }
    }),
    viteReact(),
  ],
});

Is there some plugin im not using correctly? or is this just a limitation of start?
Thank you!
Was this page helpful?