T
TanStack3mo ago
rare-sapphire

Server functions using vite-plugin-node-polyfills's shim for 'process' instead of 'node:process'

https://gist.github.com/ivanfeli/20114db6202124265bc9f49100b88b7e Extract from the built file (.output/server/chunks/_/__root-BdAHKAt1.mjs):
import process from 'vite-plugin-node-polyfills/shims/process';
...
const fnEnv = createServerFn().handler(fnEnv_createServerFn_handler, (ctx) => {
return process.env;
});
import process from 'vite-plugin-node-polyfills/shims/process';
...
const fnEnv = createServerFn().handler(fnEnv_createServerFn_handler, (ctx) => {
return process.env;
});
Relevant code:
export const fnEnv = createServerFn().handler((ctx) => {
return process.env
})

export const Route = createRootRoute({
component: RootLayout,
beforeLoad: async () => {
console.log(await fnEnv())
},
})
export const fnEnv = createServerFn().handler((ctx) => {
return process.env
})

export const Route = createRootRoute({
component: RootLayout,
beforeLoad: async () => {
console.log(await fnEnv())
},
})
Gist
TanStack Start server function polyfill issue
TanStack Start server function polyfill issue. GitHub Gist: instantly share code, notes, and snippets.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?