Skip to content
PluginStats

vite-plugin-html-env weekly downloads statistics

By lxs24sxl · npm · Vite plugins

A vite plugin for rewriting html

View on npm Fresh · Dec 6, 2026

vite-plugin-html-env has 9,893 recorded weekly downloads on npm, an increase of 27.5% over the past 30 days, ranking #1268 of 3,247 tracked listings.

Weekly downloads
9,893
Official API · Dec 5, 2026
7-day growth
+22.2%
+1.8K weekly downloads
30-day growth
+27.5%
+2.1K weekly downloads
90-day growth
+72.2%
+4.1K weekly downloads
Rank
#1268
▲ 51 in 7 days

About vite-plugin-html-env

vite-plugin-html-env npm

A Vite Plugin for rewriting html

English | 简体中文

Usage

npm install --save-dev vite-plugin-html-env
# or
yarn add vite-plugin-html-env -D
// vite.config.js
import VitePluginHtmlEnv from 'vite-plugin-html-env'

export default {
  plugins: [
    VitePluginHtmlEnv(),
    // or
    // VitePluginHtmlEnv({
    //  CUSTOM_FIELD
    // })

    // Customizable prefixes and suffixes
    // VitePluginHtmlEnv({
    //   prefix: '<{',
    //   suffix: '}>',
    //   envPrefixes: ['VITE_', 'CUSTOME_PREFIX_']
    // })

    // Enable new compile mode by default
    // 1. add directives => vite-if, vite-else
    // 2. Compatible with `import.meta.env.VITE_APP__****`
    // If there are compatibility issues with the new version, please raise the `issue` or submit a `merge request`, I will deal with it promptly in my personal free time.
    VitePluginHtmlEnv({
      compiler: true
      // compiler: false // old
    })
  ]
}

It is recommended to use VITE_APP_ as the key prefix.

# .env
VITE_APP_TITLE=测试标题
VITE_APP_HOST=dev.sever****.com

# .env.build-prod
VITE_APP_TITLE=生产标题
VITE_APP_HOST=prod.sever.****.com
{
  "scripts": {
    "start": "vite",
    "build": "tsc && vite build",
    "build:prod": "tsc && vite build --mode build-prod",
  }
}

By default, the local environment reads the .env file.Read the corresponding .env.*** file, when you configure the --mode command.Vite configuration instructions for .env files Env Variables and Modes

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <!-- Version 1.0.4 uses prefix = <{ and suffix = }> by default -->
    <!-- but is also compatible with older versions of prefixes and suffixes -->

    <!-- <script src="//<% VITE_APP_HOST />/***.js"></script> -->
    <!-- <title><% VITE_APP_TITLE /></title> -->

    <script src="//<{ VITE_APP_HOST }>/***.js"></script>
    <link rel="stylesheet" href="//<{ VITE_APP_HOST }>/test.css" />
    <title><{ VITE_APP_TITLE }></title>

    <!-- compiler: true -->
    <!-- Example 1 -->
    <!-- VITE_APP_ENV = dev -->
    <script vite-if="import.meta.env.VITE_APP_ENV === dev">
      console.log('vite-if')
    </script>
    <script vite-else>console.log('vite-else')</script>

    <!-- Example 2 -->
    <script vite-if="<{ VITE_APP_ENV }> !== dev">
      console.log('vite-if')
    </script>
    <script vite-else>
      console.log('vite-else')
    </script>

    <!-- Example 3 -->
    <!-- VITE_APP_NUM_9 = 9 -->
    <script vite-if="import.meta.env.VITE_APP_NUM_9 < 10">
      console.log('9 < 10')
    </script>
  </head>

  <body>
    <div id="root"></div>
    <script type="module" src="/src/main.tsx"></script>
  </body>
</html>

Options

prefix
  • Type: string
  • Default: '<{'
suffix
  • Type: string
  • Default: '}>'
envPrefixes

Set the prefixes attribute of the loadEnv method in dev mode, vite uses VITE_ as the prefix of environment variables by default.

  • Type: string | string[]
  • Default: VITE_
compiler
  • Type: boolean
  • Default: true

The new version of the plugin is enabled by default, and the template compilation mode is added, which contains new directives vite-if and vite-else, new parsing rules import.meta.env.VITE_APP_***.

enforce
  • Type: string
  • Default: null

The value of enforce can be either "pre" or "post". plugin-ordering

compress
  • Type: boolean
  • Default: false

Simple compression: remove spaces and line breaks

Description from the npm listing.

  • vite
  • vite-plugin
  • html
  • compiler

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

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

Adoption over time

vite-plugin-html-env weekly downloads on npm, last 90 days: 9,893 weekly downloads as of Dec 5, 2026, +72.2% over 90 days.vite-plugin-html-envWeekly downloads on npm · Last 90 days9,893downloads / week+72.2% over 90 days02K4K6K8K10K12KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
vite-plugin-html-env weekly downloads on npm, last 90 days: 9,893 weekly downloads as of Dec 5, 2026, +72.2% over 90 days.

7/30/90-day growth

vite-plugin-html-env weekly downloads growth on npm: +22.2% over 7 days, +27.5% over 30 days, +72.2% over 90 days.vite-plugin-html-envWeekly downloads growth on npm9,893downloads / week now7-day growth+1,797 weekly downloads+22.2%30-day growth+2,134 weekly downloads+27.5%90-day growth+4,149 weekly downloads+72.2%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
vite-plugin-html-env weekly downloads growth on npm: +22.2% over 7 days, +27.5% over 30 days, +72.2% over 90 days.

Ranking history

vite-plugin-html-env npm ranking history: currently #1268 (by weekly downloads).vite-plugin-html-envnpm ranking · by weekly downloads · Last 90 days#1268current rank#1100#1150#1200#1250#1300#1350Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
vite-plugin-html-env npm ranking history: currently #1268 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 64, #8 (overall #1,268)
All npm: every listing in weekly downloads order

Listing placement

Vite plugins300 listings · 15 pages · page 12, #11 (overall #231)
Vite plugins: every listing in weekly downloads order

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.

Each band is one page of 20. Weekly downloads on a linear 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.

Recent observations

Full history (170)
Recent weekly downloads observations for vite-plugin-html-env
Date (UTC)Weekly downloadsChange vs. previous
9,893-42
9,935-171
10,106+780
9,326+1.4K
7,973+304
7,669-360
8,029-67
8,096-33
8,129-431
8,560-1.1K
9,640-809
10,449-119
10,568+506
10,062—

Similar npm Vite plugins plugins

All 20 vite-plugin-html-env alternatives

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