vite-plugin-react-swc

Speed up your Vite dev server with SWC

MIT License

Downloads
5.2M
Stars
732
Committers
8

Bot releases are hidden (Show)

vite-plugin-react-swc - v3.3.2

Published by ArnaudBarre over 1 year ago

vite-plugin-react-swc - v3.3.1

Published by ArnaudBarre over 1 year ago

  • Add type: module to package.json (#101). Because the library already publish .cjs & .mjs files, the only change is for typing when using the node16 module resolution (fixes #95)
  • Throw an error when the MDX plugin is after this one (#100). This is an expected breaking change added in 3.2.0 and this should people that were using both plugins before this version to migrate.
vite-plugin-react-swc - v3.0.1

Published by ArnaudBarre almost 2 years ago

  • 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)
vite-plugin-react-swc - v3.0.0

Published by ArnaudBarre almost 2 years ago

This is plugin is now stable! πŸŽ‰

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

vite-plugin-react-swc - v3.0.0-beta.2

Published by ArnaudBarre almost 2 years ago

  • 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)
vite-plugin-react-swc - v3.0.0-beta.1

Published by ArnaudBarre almost 2 years ago

Fix package.json exports fields

vite-plugin-react-swc - v3.0.0-beta.0

Published by ArnaudBarre almost 2 years ago

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.

vite-plugin-react-swc - v0.1.1

Published by ArnaudBarre over 2 years ago

Add LICENSE

vite-plugin-react-swc - v0.1.0

Published by ArnaudBarre over 2 years ago

Initial release