Skip to content
PluginStats

vite-env-only weekly downloads statistics

By pcattori · npm · Vite plugins

Vite plugins for isolating server-only and client-only code

View on npm Fresh · Oct 17, 2026

vite-env-only has 50,536 recorded weekly downloads on npm, a decrease of 46.6% over the past 30 days.

It ranks #559 of 2,256 tracked npm listings by weekly downloads.

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

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

Weekly downloads
50,536
Official API · Oct 17, 2026
7-day growth
-51.1%
-52.8K weekly downloads
30-day growth
-46.6%
-44.1K weekly downloads
90-day growth
-46.9%
-44.6K weekly downloads
Rank
#559
Among tracked npm listings

About vite-env-only

vite-env-only

Vite plugins for isolating server-only and client-only code

Install

Deny Imports

Prevents specific packages and files from being included in the client or server bundle by throwing an error at build-time when a matching import would have been included.

specifiers

Matching is performed against the raw import specifier in the source code. Match patterns can be:

• String literal for exact matches • Globs via [micromatch][micromatch] • RegExps

files

Matching is performed against the resolved and normalized root-relative file path. Match patterns can be:

• String literal for exact matches • Globs via [micromatch][micromatch] • RegExps

Macros

All macros can be imported within your app code from "vite-env-only/macros".

serverOnly$

Marks an expression as server-only and replaces it with undefined on the client. Keeps the expression as-is on the server.

For example:

On the client this produces:

On the server this produces:

clientOnly$

Marks an expression as client-only and replaces it with undefined on the server. Keeps the expression as-is on the client.

For example:

On the client this produces:

On the server this produces:

Dead-code elimination

This plugin eliminates any identifiers that become unreferenced as a result of macro replacement.

For example, given the following usage of serverOnly$:

On the client this produces:

On the server this produces:

Type safety

The macro types capture the fact that values can be undefined depending on the environment.

For example:

If you want to opt out of strict type safety, you can use a [non-null assertion][ts-non-null] (!):

Why?

Vite already provides [import.meta.env.SSR][vite-env-vars] which works in a similar way to these macros in production. However, in development Vite neither replaces import.meta.env.SSR nor performs dead-code elimination as Vite considers these steps to be optimizations.

In general, its a bad idea to rely on optimizations for correctness. In contrast, these macros treat code replacement and dead-code elimination as part of their feature set.

Additionally, these macros use function calls to mark expressions as server-only or client-only. That means they can _guarantee_ that code within the function call never ends up in the wrong environment while only transforming a single AST node type: function call expressions.

import.meta.env.SSR is instead a special identifier which can show up in many different AST node types: if statements, ternaries, switch statements, etc. This makes it far more challenging to guarantee that dead-code completely eliminated.

Prior art

Thanks to these project for exploring environment isolation and conventions for transpilation:

• [esm-env][esm-env] • [Qwik][qwik] • [TanStack bling][bling]

Description from the npm listing.

  • vite-plugin
  • env
  • only
  • client
  • server
  • macro
  • deny
  • imports

Where vite-env-only 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,256 listings · 113 pages · page 28, #19 (overall #559)
All npm: every listing in weekly downloads order
PNG SVG
Vite plugins250 listings · 13 pages · page 5, #4 (overall #84)
Vite plugins: every listing in weekly downloads order
PNG SVG

Charts

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

Adoption over time

vite-env-only weekly downloads on npm, last 90 days: 50,536 weekly downloads as of Oct 17, 2026, -46.9% over 90 days.vite-env-onlyWeekly downloads on npm · Last 90 days50,536downloads / week-46.9% over 90 days40K60K80K100K120K140KJul 19Aug 3Aug 18Sep 2Sep 17Oct 2Oct 17downloads / weekobservedarchived (Internet Archive)no observationsJul 21, 2026 – Oct 17, 2026 · 89 observations · Updated Oc…pluginstats.com
vite-env-only weekly downloads on npm, last 90 days: 50,536 weekly downloads as of Oct 17, 2026, -46.9% over 90 days.
PNG SVG

7/30/90-day growth

vite-env-only weekly downloads growth on npm: -51.1% over 7 days, -46.6% over 30 days, -46.9% over 90 days.vite-env-onlyWeekly downloads growth on npm50,536downloads / week now7-day growth-52,790 weekly downloads-51.1%30-day growth-44,073 weekly downloads-46.6%90-day growth-44,576 weekly downloads-46.9%Growth vs. nearest observation to each baseline date · Updated Oct 17, 2026pluginstats.com
vite-env-only weekly downloads growth on npm: -51.1% over 7 days, -46.6% over 30 days, -46.9% over 90 days.
PNG SVG

Ranking history

vite-env-only npm ranking history: currently #559 (by weekly downloads).vite-env-onlynpm ranking · by weekly downloads · Last 90 days#559current rank#557#558#559#560#561Jul 21Aug 5Aug 20Sep 4Sep 19Oct 4Oct 19rankOct 18, 2026 – Oct 19, 2026 · 2 observations · Updated Oct 17, 2026pluginstats.com
vite-env-only npm ranking history: currently #559 (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-env-only
Date (UTC)Weekly downloadsChange vs. previous
50,536-5.8K
56,308+2.6K
53,674-26.3K
80,005-22.6K
102,5750
102,575+392
102,183-1.1K
103,326-366
103,692+2.5K
101,219+5.1K
96,131+2.6K
93,541-28.7K
122,205-3.6K
125,838—

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-env-only. First seen Oct 16, 2026; last successful collection Oct 19, 2026. See the methodology.