SolidJSS
SolidJS7mo ago
9 replies
Syed Samar

Server file being bundled on the frontend and env variable is undefined when used via process.env

I am facing an issue in solid start where my server file marked as "use server" is being bundled with the frontend code and I am unable to access node/server related code and getting errors in the chrome console. For testing this issue I created a basic "bare" solid start project. Created a src/lib folder with 2 files server.ts and index.ts (image attached). app.confg.ts (image attached as well). The error that I get in the console is "TEST_ENV_VARIABLE is not set" as the proces.env.TEST_ENV_VARIABLE is undefined. Also if I comment this error check and console the count value on the frontend then I get this error (see attached image).
All these errors are due to server code being bundlede on the frontend.
image.png
image.png
image.png
Was this page helpful?