-
-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: regression on variable expansion in dotenv files #1449
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aklinker1 wants to keep dependency usage down but I think this is a good thing to keep/have as I'd have a use case myself for this.
@wxt-dev/auto-icons
@wxt-dev/i18n
@wxt-dev/module-solid
@wxt-dev/module-react
@wxt-dev/module-svelte
@wxt-dev/module-vue
@wxt-dev/storage
@wxt-dev/unocss
wxt
commit: |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1449 +/- ##
==========================================
- Coverage 81.44% 81.35% -0.09%
==========================================
Files 128 128
Lines 6296 6298 +2
Branches 1074 1073 -1
==========================================
- Hits 5128 5124 -4
- Misses 1153 1159 +6
Partials 15 15 ☔ View full report in Codecov by Sentry. |
If it helps put your mind at ease, this change technically doesn't introduce any new dependencies since |
Btw, I actually explored using Vite's |
Yeah, adding this dependency makes sense. It'll at least be shared with Vite until there's a major version update and we get out of sync. |
Also, looks like there's a type error due to subdependency changes. Try running If that doesn't work, I can fix it later. |
[PR wxt-dev#978](wxt-dev#978), released in [v0.19.10](https://github.com/wxt-dev/wxt/releases/tag/wxt-v0.19.10), broke variable expansion in dotenv files, a Vite built-in feature. I encountered this while migrating from v0.18.2 to the latest. Since already defined variables in process.env take presedence, the call to dotenv-expand by vite won't have any effect. Calling dotenv-expand ourselves to mimic what vite does restores the lost functionality. Vite has a slightly more complex env loading logic, so these changes won't bring 100% parity, but should be good for most use-cases. See: https://github.com/vitejs/vite/blob/642d528b7b403eb91c67ff809ffa0fb99a1ff56e/packages/vite/src/node/env.ts
Indeed. I've pushed the package lock fix. 👍 |
Thanks for helping make WXT better! |
Overview
PR #978, released in v0.19.10,
broke variable expansion in dotenv files, a Vite built-in feature.
I encountered this while migrating from v0.18.2 to the latest.
Since already defined variables in process.env take presedence,
the call to dotenv-expand by vite won't have any effect. Calling
dotenv-expand ourselves to mimic what vite does restores the lost
functionality.
Vite has a slightly more complex env loading logic, so these changes
won't bring 100% parity, but should be good for most use-cases.
See: https://github.com/vitejs/vite/blob/642d528b7b403eb91c67ff809ffa0fb99a1ff56e/packages/vite/src/node/env.ts
Manual Testing
I've tested this in production already by applying the very same
changes with
pnpm patch
in my project.Related Issue
None reported so far (I did not bother to create an issue first).