vite-plugin-swc-transform weekly downloads statistics
By ziir · npm · Vite plugins
Vite plugin for transforming source files with SWC.
vite-plugin-swc-transform has 6,738 recorded weekly downloads on npm, a decrease of 38.8% over the past 30 days, ranking #1063 of 2,322 tracked listings.
About vite-plugin-swc-transform
vite-plugin-swc-transform 
Transform your TypeScript / JavaScript source files with SWC within your Vite build process.
- Sane defaults for TypeScript's legacy / experimental decorators & metadata.
- Full control over the rest of SWC's configuration.
Read the blog post relating the story which led to the creation of this plugin: TypeScript Legacy Experimental Decorators with Type Metadata in 2023.
Installation
npm i --save-dev vite-plugin-swc-transform
Usage
Note: This package is ESM-only.
Default SWC transform options
import { defineConfig } from "vite";
import swc from "vite-plugin-swc-transform";
export default defineConfig({
plugins: [swc()],
});
The plugin will default to the following options:
{
include: /\.tsx?$/,
exclude: /node_modules/,
swcOptions: {
{
swcrc: false,
configFile: false,
inputSourceMap: false,
sourceMaps: true
}
},
suppressLegacyDecoratorNoExplicitUDFCFWarning: false
}
Transform TypeScript Legacy / Experimental Decorators with Metadata
Example use case: build a package leveraging Nest style dependency injection with Reflect.metadata.
import { defineConfig } from "vite";
import swc from "vite-plugin-swc-transform";
export default defineConfig({
plugins: [
swc({
swcOptions: {
jsc: {
target: "es2022",
transform: {
legacyDecorator: true,
decoratorMetadata: true,
useDefineForClassFields: false,
},
// externalHelpers: true,
},
},
}),
],
});
Notes:
- should be used alongside
"compilerOptions.experimentalDecorators": true&"compilerOptions.emitDecoratorMetadata": truein yourtsconfig.json. swcOptions.jsc.externalHelpers: trueis recommended when transforming TypeScript Legacy / Experimental Decorators with Metadata to avoid helpers duplication & limit bundle size impact.- adding the
@swc/helpersdependency is then necessary.
- adding the
The above (without external helpers) will yield the following SWC transform options:
{
swcrc: false,
configFile: false,
inputSourceMap: false,
sourceMaps: true,
jsc: {
target: 'es2022',
transform: {
legacyDecorator: true,
decoratorMetadata: true,
useDefineForClassFields: false
},
keepClassNames: true,
parser: {
decorators: true,
decoratorsBeforeExport: true,
syntax: 'typescript'
}
}
}
Notes
- This plugin does not read, validate or infer from the project's
tsconfig.jsonconfiguration. - This plugin is intended to be used with an inlined
swcOptionsSWC configuration object.
'useDefineForClassFields' warning
[vite-plugin-swc-transform] SWC option 'jsc.transform.legacyDecorator' enabled without an explicit 'jsc.transform.useDefineForClassFields' value.
To remove this warning, either:
- unset or disable SWC option 'jsc.transform.legacyDecorator' if not needed
- set an explicit value for SWC option 'jsc.transform.useDefineForClassFields: boolean'
- pass vite-plugin-swc-transform option 'suppressLegacyDecoratorNoExplicitUDFCFWarning: true'
Please open an issue if you think this is incorrect or should be improved.
Description from the npm listing.
- vite
- plugin
- vite-plugin
- swc
- transform
- typescript
- decorator
- metadata
- reflect
- nest
- typeorm
- dependency injection
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-swc-transform 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-swc-transform. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.