Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve warning when encountering import.meta.env #11440

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/silly-panthers-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sveltejs/package": patch
---

fix: improve warning when encountering import.meta.env
4 changes: 2 additions & 2 deletions packages/package/src/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ export function _create_validator(options) {

if (uses_import_meta) {
warnings.push(
'Avoid usage of `import.meta.env` in your code. It requires a bundler to work. ' +
'Consider using packages like `esm-env` instead which provide cross-bundler-compatible environment variables.'
'Avoid usage of `import.meta.env` in your code. It only works in apps bundled with Vite. ' +
'Consider using packages like `esm-env` instead which works with all bundlers or without bundling.'
);
}

Expand Down
Loading