diff --git a/.changeset/silly-panthers-talk.md b/.changeset/silly-panthers-talk.md new file mode 100644 index 000000000000..0b0d19355926 --- /dev/null +++ b/.changeset/silly-panthers-talk.md @@ -0,0 +1,5 @@ +--- +"@sveltejs/package": patch +--- + +fix: improve warning when encountering import.meta.env diff --git a/packages/package/src/validate.js b/packages/package/src/validate.js index 808e99c01fdd..31d2d285bba3 100644 --- a/packages/package/src/validate.js +++ b/packages/package/src/validate.js @@ -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.' ); }