Skip to content
PluginStats

vite-plugin-runtime weekly downloads statistics

By flexbase-eng · npm · Vite plugins

Vite plugin that enables configuring runtime environment variables when building

View on npm Fresh · Dec 6, 2026

vite-plugin-runtime has 30,571 recorded weekly downloads on npm, an increase of 126% over the past 30 days, ranking #921 of 3,247 tracked listings.

Weekly downloads
30,571
Official API · Dec 5, 2026
7-day growth
+7.4%
+2.1K weekly downloads
30-day growth
+126%
+17K weekly downloads
90-day growth
+222%
+21.1K weekly downloads
Rank
#921
▼ 10 in 7 days

About vite-plugin-runtime

vite-plugin-runtime

Coverage Quality Gate Status License

Inject runtime environment variables and html based on the vite mode.

Installation

npm install --save-dev vite-plugin-runtime

or

yarn add vite-plugin-runtime --dev

runtimeEnv

Summary

This plugin allows build toolchains to inject variables at compile time instead of relying on multiple .env.* environment dotenv files. This is especially useful for values that need to be managed externally from source code.

This plugin replaces usage of import.meta.env.VITE_* with import.meta.env.*.

vitevite-plugin-runtime
import.meta.env.VITE_APP_KEYimport.meta.env.APP_KEY

.env file

vitevite-plugin-runtime
VITE_APP_KEY=some valueAPP_KEY=some value

During the build this plugin will convert all occurences of import.meta.env.* to window.env.*

CodeRuntime
import.meta.env.APP_KEYwindow.env.APP_KEY
Usage
vite.config

The plugin options can be injected in the constructor or as a separate object on the vite config object.

import { runtimeEnv } from 'vite-plugin-runtime';

export default defineConfig({
  plugins: [
    runtimeEnv(),
  ],
  runtimeEnv: {}, // optional configuration object
Configuration
name

This is the name of the object attached to the window instance. Default is env.

name?: (() => string) | string
runtimeEnv({
  name: 'customName',
}),

outputs window.customName.*

generateTypes

Specificies whether to generate typescript types for import.meta.env. Default is false.

generateTypes?: boolean
runtimeEnv({
  generateTypes: true,
}),
generatedTypesPath

The path to generate typescript types. Only takes affect if generateTypes is true. Default is process.cwd()

generatedTypesPath?: (() => string) | string
runtimeEnv({
  generatedTypesPath: () => './src',
}),

generatedTypesPath combined with generateTypes will create a type definition file env.d.ts:

/** generated by vite-plugin-runtime */
interface ImportMetaEnv {
  readonly APP_KEY: string;
}
interface ImportMeta {
  readonly env: ImportMetaEnv;
}
injectHtml

Specifies whether to inject an env loading script into index.html. Defaults to true.

injectHtml?: boolean
runtimeEnv({
  injectHtml: false,
}),

When true the plugin will inject

<script type="module">
  import rtenv from '/env.js';
  window.env = { ...window.env, ...rtenv };
</script>

into the index.html <head></head> section.

The generated script will resemble:

export default {
  APP_KEY: 'some value',
};
envsubstTemplate

Specifies whether to create an envsubst template file at build time. Defaults to false.

envsubstTemplate?: boolean
runtimeEnv({
  envsubstTemplate: true,
}),

When true the plugin will create the following template file:

export default {
  APP_KEY: $APP_KEY,
};

runtimeHtml

Summary

This plugin allows an easy way to inject html into index.html at compile time based on the vite mode. This is useful for scripts like google tag manager that should only be loaded for certain environments like production.

Usage
vite.config

The plugin options can be injected in the constructor or as a separate object on the vite config object.

import { runtimeHtml } from 'vite-plugin-runtime';

export default defineConfig({
  plugins: [
    runtimeHtml(),
  ],
  runtimeHtml: {}, // optional configuration object
Configuration

see HtmlTagDescriptor

mode: HtmlTagDescriptor[]
runtimeHtml({
  production: [
      {
        tag: 'script',
        attrs: {
          type: 'text/javascript',
          src: '/some_file.js',
        },
        injectTo: 'head',
      },
    ],
  staging: [
    {
      tag: 'title',
      children: 'Staging',
    }
  ]
}),

Description from the npm listing.

  • flexbase
  • flex
  • vite
  • vite-plugin

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-runtime weekly downloads on npm, last 90 days: 30,571 weekly downloads as of Dec 5, 2026, +222% over 90 days.vite-plugin-runtimeWeekly downloads on npm · Last 90 days30,571downloads / week+222% over 90 days05K10K15K20K25K30K35K40KSep 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-runtime weekly downloads on npm, last 90 days: 30,571 weekly downloads as of Dec 5, 2026, +222% over 90 days.

7/30/90-day growth

vite-plugin-runtime weekly downloads growth on npm: +7.4% over 7 days, +126% over 30 days, +222% over 90 days.vite-plugin-runtimeWeekly downloads growth on npm30,571downloads / week now7-day growth+2,105 weekly downloads+7.4%30-day growth+17,034 weekly downloads+126%90-day growth+21,082 weekly downloads+222%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
vite-plugin-runtime weekly downloads growth on npm: +7.4% over 7 days, +126% over 30 days, +222% over 90 days.

Ranking history

vite-plugin-runtime npm ranking history: currently #921 (by weekly downloads).vite-plugin-runtimenpm ranking · by weekly downloads · Last 90 days#921current rank#800#850#900#950#1000#1050#1100#1150Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
vite-plugin-runtime npm ranking history: currently #921 (by weekly downloads).

Listing placement

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

Listing placement

Vite plugins300 listings · 15 pages · page 8, #17 (overall #157)
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-runtime
Date (UTC)Weekly downloadsChange vs. previous
30,571-85
30,656+1.9K
28,759+3.1K
25,670-1.1K
26,793-1.1K
27,880-587
28,467+1
28,466-328
28,794-2.8K
31,575-3.6K
35,159-650
35,809+1.5K
34,306-165
34,471—

Similar npm Vite plugins plugins

All 20 vite-plugin-runtime 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-runtime. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.