
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@z-code/vite-plugin-swc
Advanced tools
A high-performance Vite plugin that transforms TypeScript and JavaScript files using SWC for lightning-fast builds
A Vite plugin that transforms TypeScript and JavaScript source files using SWC during the build process. SWC is a super-fast Rust-based compiler that significantly accelerates your build times compared to traditional Babel or tsc compilation.
⚡ Blazing Fast: Leverages SWC's Rust-based compilation for faster builds
🔧 Flexible Configuration: Supports both inline options and .swcrc configuration files
🎯 TypeScript First: Excellent TypeScript support with decorators and metadata
🔌 Seamless Integration: Works out of the box with Vite's build pipeline
🛠 Modern JavaScript: Supports latest ECMAScript features including top-level await
yarn
yarn add @z-code/vite-plugin-swc --dev
pnpm
pnpm add @z-code/vite-plugin-swc --save-dev
npm
npm install @z-code/vite-plugin-swc --save-dev
Add the plugin to your Vite configuration:
// vite.config.ts
import { defineConfig } from "vite";
import swc from "@z-code/vite-plugin-swc";
export default defineConfig({
plugins: [swc()],
});
When no options are provided, the plugin uses the following defaults:
{
include: /\.ts?$/,
exclude: "node_modules",
swcrc: false,
configFile: false,
minify: true,
jsc: {
parser: {
syntax: "typescript",
decorators: true,
},
transform: {
decoratorMetadata: true,
decoratorVersion: "2022-03",
},
},
}
This configuration provides:
TypeScript support with modern decorators (Stage 3)
Decorator metadata transformation
Minification enabled by default
Top-level await support
You can override any of the default options:
// vite.config.ts
import { defineConfig } from "vite";
import swc from "@z-code/vite-plugin-swc";
export default defineConfig({
plugins: [
swc({
include: /\.(ts|tsx|js|jsx)?$/,
exclude: /node_modules/,
minify: process.env.NODE_ENV === "production",
jsc: {
parser: {
syntax: "typescript",
tsx: true,
decorators: true,
},
transform: {
react: {
runtime: "automatic",
},
decoratorMetadata: true,
decoratorVersion: "2022-03",
},
},
}),
],
});
If you prefer to use a configuration file, set swcrc and configFile to true:
// vite.config.ts
import { defineConfig } from "vite";
import swc from "@z-code/vite-plugin-swc";
export default defineConfig({
plugins: [
swc({
include: /\.ts?$/,
swcrc: true,
configFile: true,
}),
],
});
Then create a .swcrc file in your project root:
{
"$schema": "https://json.schemastore.org/swcrc",
"exclude": "node_modules",
"jsc": {
"parser": {
"syntax": "typescript",
"decorators": true,
"dynamicImport": true
},
"transform": {
"decoratorMetadata": true,
"decoratorVersion": "2022-03"
},
"target": "es2022",
"loose": false,
"externalHelpers": false
},
"minify": true
}
Replace tsc with SWC for significantly faster TypeScript compilation during production builds.
Use the latest decorator syntax (Stage 3) with metadata reflection.
Build libraries with optimized output and modern JavaScript features.
Speed up build times in large codebases where traditional TypeScript compilation becomes a bottleneck.
This plugin is a fork of vite-plugin-swc-transform. The migration is straightforward:
npm uninstall vite-plugin-swc-transform
npm install @z-code/vite-plugin-swc --save-dev
- import swc from "vite-plugin-swc-transform"
+ import swc from "@z-code/vite-plugin-swc"
This project is a fork of vite-plugin-swc-transform. Special thanks to Timothée “Tim” Pillard for the original implementation and great work.
TypeScript Decorators Proposal
Found a bug or have a feature request? Please open an issue on GitHub.
Contributions are welcome! Please feel free to submit a Pull Request.
FAQs
A high-performance Vite plugin that transforms TypeScript and JavaScript files using SWC for lightning-fast builds
The npm package @z-code/vite-plugin-swc receives a total of 12 weekly downloads. As such, @z-code/vite-plugin-swc popularity was classified as not popular.
We found that @z-code/vite-plugin-swc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.