You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@vitejs/plugin-react-swc

Package Overview
Dependencies
Maintainers
5
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Previous
1

3.1.0-beta.2

Diff

patak
published 3.0.1 •

Changelog

Source

3.0.1

  • Support Emotion via the new jsxImportSource option (fixes #25)

To use it with Emotion, update your config to:

export default defineConfig({
  plugins: [react({ jsxImportSource: "@emotion/react" })],
});
  • Fix HMR when using Vite base option (fixes #18)
  • Fix usage with workers (fixes #23)
  • Fix usage with Vite Ruby and Laravel Vite (#20)
  • Fix plugin default export when using commonjs (fixes #14)
patak
published 3.0.0 •

Changelog

Source

3.0.0

This is plugin is now stable! 🎉

To migrate from vite-plugin-swc-react-refresh, see the 3.0.0-beta.0 changelog.

patak
published 3.0.0-beta.2 •

Changelog

Source

3.0.0-beta.2

  • breaking: update plugin name to vite:react-swc to match official plugins naming
  • fix: don't add React Refresh wrapper for SSR transform (fixes #11)
patak
published 3.0.0-beta.1 •

Changelog

Source

3.0.0-beta.1

Fix package.json exports fields

patak
published 3.0.0-beta.0 •

Changelog

Source

3.0.0-beta.0

This is the first beta version of the official plugin for using SWC with React in Vite!

Some breaking changes have been made to make the plugin closer to the Babel one while keeping the smallest API surface possible to reduce bugs, encourage future-proof compilation output and allow easier opt-in into future perf improvements (caching, move to other native toolchain, ...):

  • Automatically enable automatic JSX runtime. "classic" runtime is not supported
  • Skip transformation for .js files
  • Enforce useDefineForClassFields
  • Don't pass esbuild.define config option to SWC. You can use the top level define option instead
  • Use default export

To migrate, change your config to:

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";

export default defineConfig({
  plugins: [react()],
});

This new release also include a runtime check for React refresh boundaries. When the conditions are not met (most of the time, exporting React components alongside functions or constant), the module is invalidated with a warning message to help you catch issues while keeping you page up-to date with code changes.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc