Cannot get custom server entrypoint with Start + Cloudflare
hey,
trying to get TanStack Start deployed to Cloudflare Workers.
As soon as I enable Cloudflare Vite plugin, CSS and JS stop working completely. it is ok without cloudflare plugin.
I confirmed it is all about using custom server entry.
As soon as I switched to:
it started to work and all assets are loaded, but then my Paraglide localisation doesn't work of course.
How to use custom server entry with TanStrack Start + Cloudflare stack then to keep it working?
3 Replies
fair-rose•2mo ago
i use this , not sure if it wil fix your issue "main": "./src/server.ts",
correct-apricotOP•2mo ago
Indeed after poitning to existing ts/tsx file it works LOCALLY now for me, but when I try to deploy, after successfull build of Vite,
I hit this with wrangler:
[ERROR] Could not resolve "#tanstack-router-entry"
../../node_modules/.pnpm/@tanstack+start-server-core@1.133.15/node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js:29:33: 29 │ routerEntry = await import("#tanstack-router-entry"); ╵~~~~~~~~
The package import "#tanstack-router-entry" is not defined in this "imports" map:
../../node_modules/.pnpm/@tanstack+start-server-core@1.133.15/node_modules/@tanstack/start-server-core/package.json:43:13: 43 │ "imports": { ╵ ^
You can mark the path "#tanstack-router-entry" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time. my server entry is rather simple so not sure why I get into this really
../../node_modules/.pnpm/@tanstack+start-server-core@1.133.15/node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js:29:33: 29 │ routerEntry = await import("#tanstack-router-entry"); ╵
The package import "#tanstack-router-entry" is not defined in this "imports" map:
../../node_modules/.pnpm/@tanstack+start-server-core@1.133.15/node_modules/@tanstack/start-server-core/package.json:43:13: 43 │ "imports": { ╵ ^
You can mark the path "#tanstack-router-entry" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time. my server entry is rather simple so not sure why I get into this really
stormy-gold•2mo ago
can you please provide a complete reproducer project? this should just work