Skip to content
PluginStats

vite-plugin-environment weekly downloads statistics

By ElMassimo (8 listings) · npm · Vite plugins

Easily expose environment variables in Vite.js

View on npm Fresh · Oct 17, 2026

vite-plugin-environment has 173,919 recorded weekly downloads on npm, a decrease of 58.4% over the past 30 days.

It ranks #386 of 2,251 tracked npm listings by weekly downloads.

Over 90 days, weekly downloads changed by -62.8%.

PluginStats has 121 daily observations since Jun 19, 2026; the latest is from Oct 17, 2026.

Weekly downloads
173,919
Official API · Oct 17, 2026
7-day growth
-57.5%
-235.7K weekly downloads
30-day growth
-58.4%
-244.2K weekly downloads
90-day growth
-62.8%
-293.8K weekly downloads
Rank
#386
Among tracked npm listings

About vite-plugin-environment

vite-plugin-environment

Expose environment variables to your client code in Vite.js

Why? 🤔

Although [Vite.js] provides its [own mechanism][meta env] for exposing environment variables through [import.meta.env][meta env], sometimes it's not possible or desirable to prefix variables with VITE_.

This plugin is a shorthand for exposing environment variables by configuring [define].

It provides the same functionality as webpack's [EnvironmentPlugin], but for Vite.js.

Installation 💿

Install the package as a development dependency:

Usage 🚀

You can provide a list of environment variable names to expose to your client code:

And then use them as:

Usage with default values

You may instead provide an object which maps keys to their default values.

The default value for a key is only used if the variable is not defined.

Use null for optional variables, or undefined for variables that must be provided.

Configuration ⚙️

Have in mind that you can add the plugin several times—passing different options to load different sets of variables.

Loading prefixed variables

In some cases, it's useful to load all environment variables with a certain prefix.

You can achieve that by passing 'all' and providing the prefix option.

and then use it as usual:

Exposing variables differently

When porting apps to Vite or using SSR it can be useful to expose variables in process.env, which is the default.

In other cases, you may use the defineOn option to expose them in a different object, such as import.meta.env.

and then use it as:

Ignoring .env files

By default the plugin will load .env files using the same [strategy][meta env] as Vite.js.

If you want to ignore .env files and only use values in process.env, you can opt out:

Inside the box 📦

The first example in this README is equivalent to [manually configuring][define]:

except it will also use any variables provided by your .env files, and will fail if any of the specified variables is _not defined_.

Acknowledgements

I created this library only because I wanted something that:

• Reused Vite's loadEnv functionality, making the library _very_ light (no dependencies). • Allowed to provide a subset of variables to expose, and their defaults.

The following libraries might be helpful depending on your use case:

• [vite-plugin-env-compatible]: Convenient if you are porting a Vue CLI or create-react-app.

License

This library is available as open source under the terms of the MIT License.

Description from the npm listing.

  • env
  • environment
  • variables
  • vite
  • vite-plugin
  • vitejs

Where vite-plugin-environment sits in the listing

Each band is one page of 20. Weekly downloads on a log scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

All npm2,248 listings · 113 pages · page 20, #6 (overall #386)
All npm: every listing in weekly downloads order
PNG SVG
Vite plugins250 listings · 13 pages · page 3, #7 (overall #47)
Vite plugins: every listing in weekly downloads order
PNG SVG

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

vite-plugin-environment weekly downloads on npm, last 90 days: 173,919 weekly downloads as of Oct 17, 2026, -62.8% over 90 days.vite-plugin-environmentWeekly downloads on npm · Last 90 days173,919downloads / week-62.8% over 90 days0100K200K300K400K500K600KJul 19Aug 3Aug 18Sep 2Sep 17Oct 2Oct 17downloads / weekobservedarchived (Internet Archive)no observationsJul 20, 2026 – Oct 17, 2026 · 90 observations · Updated Oc…pluginstats.com
vite-plugin-environment weekly downloads on npm, last 90 days: 173,919 weekly downloads as of Oct 17, 2026, -62.8% over 90 days.
PNG SVG

7/30/90-day growth

vite-plugin-environment weekly downloads growth on npm: -57.5% over 7 days, -58.4% over 30 days, -62.8% over 90 days.vite-plugin-environmentWeekly downloads growth on npm173,919downloads / week now7-day growth-235,711 weekly downloads-57.5%30-day growth-244,192 weekly downloads-58.4%90-day growth-293,784 weekly downloads-62.8%Growth vs. nearest observation to each baseline date · Updated Oct 17, 2026pluginstats.com
vite-plugin-environment weekly downloads growth on npm: -57.5% over 7 days, -58.4% over 30 days, -62.8% over 90 days.
PNG SVG

Ranking history

vite-plugin-environment npm ranking history: currently #386 (by weekly downloads).vite-plugin-environmentnpm ranking · by weekly downloads · Last 90 days#386current rank#384#385#386#387#388Jul 20Aug 4Aug 19Sep 3Sep 18Oct 3Oct 18rankOct 18, 2026 – Oct 18, 2026 · 1 observations · Updated Oct 17, 2026pluginstats.com
vite-plugin-environment npm ranking history: currently #386 (by weekly downloads).
PNG SVG

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Recent observations

Full history (121)
Recent weekly downloads observations for vite-plugin-environment
Date (UTC)Weekly downloadsChange vs. previous
173,919-19K
192,916+1.3K
191,644-97.2K
288,846-100.2K
389,0820
389,082-17.8K
406,896-2.7K
409,630-1K
410,655+427
410,228-6.8K
417,006-743
417,749-103.4K
521,168-652
521,820—

Similar npm Vite plugins plugins

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/vite-plugin-environment. First seen Oct 16, 2026; last successful collection Oct 18, 2026. See the methodology.