Skip to content

Add shared local env loading helpers - #15390

Merged
jamesopstad merged 3 commits into
mainfrom
james/workers-utils-local-env
Sep 1, 2026
Merged

Add shared local env loading helpers#15390
jamesopstad merged 3 commits into
mainfrom
james/workers-utils-local-env

Conversation

@jamesopstad

@jamesopstad jamesopstad commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Add shared local env loading helpers with Vite-compatible .env file resolution and Wrangler-compatible parsing and expansion. Mode-specific .dev.vars files are selected exclusively and are not merged with .env files or process values.

This is for use in Vite plugin v2 and cf.

Note that complete alignment with Vite was avoided because Vite patches dotenv-expand.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: internal change

A picture of a cute animal (not mandatory, but encouraged)

@changeset-bot

changeset-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ecc294b

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

@pkg-pr-new

pkg-pr-new Bot commented Aug 27, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@15390

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15390

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@15390

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15390

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@15390

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@15390

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@15390

miniflare

npm i https://pkg.pr.new/miniflare@15390

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15390

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@15390

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@15390

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@15390

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@15390

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@15390

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@15390

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@15390

wrangler

npm i https://pkg.pr.new/wrangler@15390

commit: ecc294b

ask-bonk[bot]

This comment was marked as resolved.

@ask-bonk

ask-bonk Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

I'm Bonk, and I've done a quick review of your PR.

Adds shared .env and .dev.vars loading helpers.

  1. P1: Posted 1 inline suggestion.

github run

@jamesopstad
jamesopstad force-pushed the james/workers-utils-local-env branch from 7756f93 to 72f709f Compare August 27, 2026 22:18
@jamesopstad
jamesopstad marked this pull request as ready for review August 27, 2026 22:18
@workers-devprod
workers-devprod requested review from a team and NuroDev and removed request for a team August 27, 2026 22:19
@workers-devprod

workers-devprod commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@NuroDev NuroDev 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.

Overall LGTM. Just needs that Bonk comment addressing

Comment thread packages/workers-utils/src/local-env.ts
Comment thread packages/workers-utils/src/local-env.ts
Comment thread packages/workers-utils/src/local-env.ts
@jamesopstad
jamesopstad force-pushed the james/workers-utils-local-env branch from 72f709f to 92579e8 Compare September 1, 2026 14:29

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 2 new potential issues.

Devin Review

Comment thread packages/workers-utils/src/local-env.ts
Comment thread packages/workers-utils/src/local-env.ts Outdated

@NuroDev NuroDev 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.

Seems there is some conflicts that need fixing but then good to merge

@jamesopstad
jamesopstad force-pushed the james/workers-utils-local-env branch from 92579e8 to ecc294b Compare September 1, 2026 19:22

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Codeowners reviews satisfied

@jamesopstad
jamesopstad merged commit fd17fc5 into main Sep 1, 2026
72 of 74 checks passed
@jamesopstad
jamesopstad deleted the james/workers-utils-local-env branch September 1, 2026 20:15
@github-project-automation github-project-automation Bot moved this from Untriaged to Done in workers-sdk Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants