solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

server env variables require additonal configuration / packages

Open OrJDev opened this issue 2 years ago • 0 comments

Currently enviroment variables that are not prefixed with VITE_ will not be loaded, variables that are prefixed with VITE_ will be exposed to the client (import.meta.env), what causing it so there is no such thing as server env variable in SolidStart.

this could easily be fixed using dotenv:

import solid from "solid-start/vite";
import dotenv from "dotenv";
import UnoCSS from "unocss/vite";
import { defineConfig } from "vite";
// @ts-expect-error no typing
import vercel from "solid-start-vercel";
  
export default defineConfig(() => {
  dotenv.config();
  return {
    plugins: [
          solid({ ssr: false, adapter: vercel({ edge: false }) }),
          UnoCSS(),
        ],
  };
});

but I think that it should not be handled in our end as SolidStart is a meta framework, and should be loading server variables by default.

OrJDev avatar Nov 26 '22 11:11 OrJDev