Skip to content

feat: add env:*#2110

Merged
atilafassina merged 10 commits into
mainfrom
feat-runtime-env
Mar 26, 2026
Merged

feat: add env:*#2110
atilafassina merged 10 commits into
mainfrom
feat-runtime-env

Conversation

@lxsmnsyc

@lxsmnsyc lxsmnsyc commented Mar 16, 2026

Copy link
Copy Markdown
Member

This PR adds the env:server and env:client modules

// Loads SERVER_* from .env
// Throws and omits all detected variables on client runtime
import { SERVER_EXAMPLE } from 'env:server';

console.log(SERVER_EXAMPLE);

// Loads CLIENT_* from .env
import { CLIENT_EXAMPLE } from 'env:client';

console.log(CLIENT_EXAMPLE);

// Dynamically loads environment variables (only on server)
import env from 'env:server/runtime';

console.log(env.NODE_ENV);

closes #2113

@changeset-bot

changeset-bot Bot commented Mar 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eeb2093

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Mar 16, 2026

Copy link
Copy Markdown

Deploy Preview for solid-start-landing-page ready!

Name Link
🔨 Latest commit eeb2093
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/69c55fcb4cf1bc0008ad0d0e
😎 Deploy Preview https://deploy-preview-2110--solid-start-landing-page.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Mar 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/solidjs/solid-start/@solidjs/start@2110
npm i https://pkg.pr.new/solidjs/solid-start/@solidjs/vite-plugin-nitro-2@2110

commit: eeb2093

Comment thread packages/start/src/config/env.ts

@themavik themavik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review

convertObjectToModule in packages/start/src/config/env.ts has a console.log(result) on line 46 — that will log the generated module string on every env load. Should be removed before merge.

Comment thread packages/start/src/config/env.ts Outdated

@atilafassina atilafassina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before merging this one, let's make sure we have some tests.
specially assuring that there's no way secrets can leak

@atilafassina atilafassina enabled auto-merge (squash) March 26, 2026 16:30
@atilafassina atilafassina merged commit b9c4ade into main Mar 26, 2026
10 checks passed
@atilafassina atilafassina deleted the feat-runtime-env branch March 26, 2026 16:34
@eru123

eru123 commented Mar 26, 2026

Copy link
Copy Markdown

Nice, this is a great feat, ensuring server and client env is loaded differently!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug?]: 2.0.0-alpha.2 - process.env not available in server functions

6 participants