vite-plugin-legacy-swc weekly downloads statistics
By CyanSalt · npm · Vite plugins
Provides legacy browsers support for the production build with SWC
vite-plugin-legacy-swc has 1,983 recorded weekly downloads on npm, a decrease of 76.8% over the past 30 days, ranking #1355 of 2,391 tracked listings.
About vite-plugin-legacy-swc
vite-plugin-legacy-swc
Provides legacy browsers support for the production build with SWC.
This package is intended to replace @vitejs/plugin-legacy in performance-sensitive situations. It is basically an implementation of vitejs/vite#4105.
As for performance, for reference, the results of my tests on a huge private project (with { modernPolyfills: true }) are as follows:
| Without legacy browsers support | With @vitejs/plugin-legacy | With vite-plugin-legacy-swc | |
|---|---|---|---|
| CPU Time | 146.45s | 697.82s | 295.04s |
| JS Asset Size* | 9.5M | 22M | 21M |
| JS Asset Size Without Legacy Chunks | 9.5M | 9.6M | 9.6M |
Compared to @vitejs/plugin-legacy, vite-plugin-legacy-swc saves 58% of time and 4% of JS asset size.
* In my current tests, @vitejs/plugin-legacy does not generate source maps for legacy chunks correctly, so the asset size statistics exclude the source maps.
Vite's minimum browser support target is Native ESM, native ESM dynamic import, and import.meta. This plugin provides support for legacy browsers that do not support those features when building for production.
By default, this plugin will:
-
Generate a corresponding legacy chunk for every chunk in the final bundle, transformed with @swc/core and emitted as SystemJS modules (code splitting is still supported!).
-
Generate a polyfill chunk including SystemJS runtime, and any necessary polyfills determined by specified browser targets and actual usage in the bundle.
-
Inject
<script nomodule>tags into generated HTML to conditionally load the polyfills and legacy bundle only in browsers without widely-available features support. -
Inject the
import.meta.env.LEGACYenv variable, which will only betruein the legacy production build, andfalsein all other cases.
Usage
// vite.config.js
import legacy from 'vite-plugin-legacy-swc'
export default {
plugins: [
legacy({
targets: ['defaults', 'not IE 11'],
}),
],
}
Options
targets
-
Type:
string | string[] | { [key: string]: string } -
Default:
'last 2 versions and not dead, > 0.3%, Firefox ESR'It's passed on to
@swc/corewhen rendering legacy chunks.The query is also Browserslist compatible. See Browserslist Best Practices for more details.
If it's not set, plugin-legacy-swc will load the browserslist config sources and then fallback to the default value.
[!NOTE] Some browserslist queries are not supported in
targetsandmodernTargetssince SWC usesbrowserslist-rs. See Limitations.
modernTargets
-
Type:
string | string[] -
Default:
'edge>=79, firefox>=67, chrome>=64, safari>=12, chromeAndroid>=64, iOS>=12'It's passed on to
@swc/corewhen collecting polyfills for modern chunks. The value set here will override thebuild.targetoption.The query is also Browserslist compatible. See Browserslist Best Practices for more details.
If it's not set, plugin-legacy-swc will fallback to the default value.
Note that this options should not be set unless
renderLegacyChunksis set tofalse.
polyfills
-
Type:
boolean | string[] -
Default:
trueBy default, a polyfills chunk is generated based on the target browser ranges and actual usage in the final bundle (detected via
@swc/core'smode: 'usage').Set to a list of strings to explicitly control which polyfills to include. See Polyfill Specifiers for details.
Set to
falseto avoid generating polyfills and handle it yourself (will still generate legacy chunks with syntax transformations).
additionalLegacyPolyfills
-
Type:
string[]Add custom imports to the legacy polyfills chunk. Since the usage-based polyfill detection only covers ES language features, it may be necessary to manually specify additional DOM API polyfills using this option.
additionalModernPolyfills
-
Type:
string[]Add custom imports to the modern polyfills chunk. Since the usage-based polyfill detection only covers ES language features, it may be necessary to manually specify additional DOM API polyfills using this option.
modernPolyfills
-
Type:
boolean | string[] -
Default:
falseDefaults to
false. Enabling this option will generate a separate polyfills chunk for the modern build (targeting browsers that support widely-available features).Set to a list of strings to explicitly control which polyfills to include. See Polyfill Specifiers for details.…
Description from the npm listing.
- vite
- vite-plugin
- legacy
- swc
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
7/30/90-day growth
Ranking history
Listing placement
Listing placement
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 (122)Similar npm Vite plugins plugins
All 20 vite-plugin-legacy-swc alternativesData 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-legacy-swc. First seen Oct 16, 2026; last successful collection Oct 21, 2026. See the methodology.