vite-plugin-runtime weekly downloads statistics
By flexbase-eng · npm · Vite plugins
Vite plugin that enables configuring runtime environment variables when building
vite-plugin-runtime has 6,361 recorded weekly downloads on npm, a decrease of 18.3% over the past 30 days.
It ranks #1022 of 2,251 tracked npm listings by weekly downloads.
Over 90 days, weekly downloads changed by -23.7%.
PluginStats has 121 daily observations since Jun 19, 2026; the latest is from Oct 17, 2026.
About vite-plugin-runtime
vite-plugin-runtime
Inject runtime environment variables and html based on the vite mode.
Installation
or
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.*.
| vite | vite-plugin-runtime |
| import.meta.env.VITE_APP_KEY | import.meta.env.APP_KEY |
.env file
| vite | vite-plugin-runtime |
| VITE_APP_KEY=some value | APP_KEY=some value |
During the build this plugin will convert all occurences of import.meta.env.* to window.env.*
| Code | Runtime |
| import.meta.env.APP_KEY | window.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.
Configuration
name
This is the name of the object attached to the window instance. Default is env.
outputs window.customName.*
generateTypes
Specificies whether to generate typescript types for import.meta.env. Default is false.
generatedTypesPath
The path to generate typescript types. Only takes affect if generateTypes is true. Default is process.cwd()
generatedTypesPath combined with generateTypes will create a type definition file env.d.ts:
injectHtml
Specifies whether to inject an env loading script into index.html. Defaults to true.
When true the plugin will inject
into the index.html section.
The generated script will resemble:
envsubstTemplate
Specifies whether to create an envsubst template file at build time. Defaults to false.
When true the plugin will create the following template file:
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.
Configuration
see HtmlTagDescriptor
Description from the npm listing.
- flexbase
- flex
- vite
- vite-plugin
Where vite-plugin-runtime 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.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
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)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-runtime. First seen Oct 16, 2026; last successful collection Oct 18, 2026. See the methodology.