Skip to content

Commit

Permalink
fix: improve warning when encountering import.meta.env (#11440)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored and eltigerchino committed Jan 9, 2024
1 parent 928d53b commit 39745e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit 39745e6

Please sign in to comment.