Skip to content

server env variables require additonal configuration / packages #480

@OrJDev

Description

@OrJDev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions