You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@vitejs/plugin-react

Package Overview
Dependencies
Maintainers
4
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vitejs/plugin-react - npm Package Compare versions

Comparing version
5.1.2
to
5.1.3
+11
-0
dist/index.d.ts

@@ -6,3 +6,14 @@ import { Plugin, ResolvedConfig } from "vite";

interface Options {
/**
* Can be used to process extra files like `.mdx`
* @example include: /\.(mdx|js|jsx|ts|tsx)$/
* @default /\.[tj]sx?$/
*/
include?: string | RegExp | Array<string | RegExp>;
/**
* Can be used to exclude JSX/TSX files that runs in a worker or are not React files.
* Except if explicitly desired, you should keep node_modules in the exclude list
* @example exclude: [/\/pdf\//, /\.solid\.tsx$/, /\/node_modules\//]
* @default /\/node_modules\//
*/
exclude?: string | RegExp | Array<string | RegExp>;

@@ -9,0 +20,0 @@ /**

+10
-10

@@ -0,7 +1,7 @@

import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { readFileSync } from "node:fs";
import { exactRegex, makeIdFiltersToMatchWithQuery } from "@rolldown/pluginutils";
import * as vite from "vite";
import { createFilter } from "vite";
import { exactRegex, makeIdFiltersToMatchWithQuery } from "@rolldown/pluginutils";

@@ -187,10 +187,10 @@ //#region ../common/refresh-utils.ts

const plugins = [...babelOptions.plugins];
let reactCompilerPlugin$1 = getReactCompilerPlugin(plugins);
if (reactCompilerPlugin$1 && ssr) {
plugins.splice(plugins.indexOf(reactCompilerPlugin$1), 1);
reactCompilerPlugin$1 = void 0;
let reactCompilerPlugin = getReactCompilerPlugin(plugins);
if (reactCompilerPlugin && ssr) {
plugins.splice(plugins.indexOf(reactCompilerPlugin), 1);
reactCompilerPlugin = void 0;
}
if (Array.isArray(reactCompilerPlugin$1) && reactCompilerPlugin$1[1]?.compilationMode === "annotation" && !compilerAnnotationRE.test(code)) {
plugins.splice(plugins.indexOf(reactCompilerPlugin$1), 1);
reactCompilerPlugin$1 = void 0;
if (Array.isArray(reactCompilerPlugin) && reactCompilerPlugin[1]?.compilationMode === "annotation" && !compilerAnnotationRE.test(code)) {
plugins.splice(plugins.indexOf(reactCompilerPlugin), 1);
reactCompilerPlugin = void 0;
}

@@ -212,3 +212,3 @@ const isJSX = filepath.endsWith("x");

sourceFileName: filepath,
retainLines: reactCompilerPlugin$1 ? false : !isProduction && isJSX && opts.jsxRuntime !== "classic",
retainLines: reactCompilerPlugin ? false : !isProduction && isJSX && opts.jsxRuntime !== "classic",
parserOpts: {

@@ -215,0 +215,0 @@ ...babelOptions.parserOpts,

{
"name": "@vitejs/plugin-react",
"version": "5.1.2",
"license": "MIT",
"author": "Evan You",
"version": "5.1.3",
"description": "The default Vite plugin for React projects",
"keywords": [
"vite",
"vite-plugin",
"babel",
"fast refresh",
"react",
"babel",
"react-refresh",
"fast refresh"
"vite",
"vite-plugin"
],
"homepage": "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#readme",
"bugs": {
"url": "https://github.com/vitejs/vite-plugin-react/issues"
},
"license": "MIT",
"author": "Evan You",
"contributors": [

@@ -19,5 +23,10 @@ "Alec Larson",

],
"repository": {
"type": "git",
"url": "git+https://github.com/vitejs/vite-plugin-react.git",
"directory": "packages/plugin-react"
},
"files": [
"types",
"dist"
"dist",
"types"
],

@@ -35,33 +44,36 @@ "type": "module",

},
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/vitejs/vite-plugin-react.git",
"directory": "packages/plugin-react"
},
"bugs": {
"url": "https://github.com/vitejs/vite-plugin-react/issues"
},
"homepage": "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#readme",
"dependencies": {
"@babel/core": "^7.28.5",
"@babel/core": "^7.29.0",
"@babel/plugin-transform-react-jsx-self": "^7.27.1",
"@babel/plugin-transform-react-jsx-source": "^7.27.1",
"@rolldown/pluginutils": "1.0.0-beta.53",
"@rolldown/pluginutils": "1.0.0-rc.2",
"@types/babel__core": "^7.20.5",
"react-refresh": "^0.18.0"
},
"devDependencies": {
"@vitejs/react-common": "workspace:*",
"babel-plugin-react-compiler": "19.1.0-rc.3",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"rolldown": "1.0.0-rc.2",
"tsdown": "^0.20.1"
},
"peerDependencies": {
"vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
},
"devDependencies": {
"@vitejs/react-common": "workspace:*",
"babel-plugin-react-compiler": "19.1.0-rc.3",
"react": "^19.2.1",
"react-dom": "^19.2.1",
"rolldown": "1.0.0-beta.53",
"tsdown": "^0.17.1"
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
"compatiblePackages": {
"schemaVersion": 1,
"rolldown": {
"type": "compatible",
"versions": "^1.0.0-beta.44",
"note": "You can use Rolldown's built-in feature directly."
},
"rollup": {
"type": "incompatible",
"reason": "Uses Rolldown-specific APIs or Vite-specific APIs"
}
}
}

@@ -22,5 +22,5 @@ # @vitejs/plugin-react [![npm](https://img.shields.io/npm/v/@vitejs/plugin-react.svg)](https://npmjs.com/package/@vitejs/plugin-react)

### include/exclude
### include
Includes `.js`, `.jsx`, `.ts` & `.tsx` and excludes `/node_modules/` by default. This option can be used to add fast refresh to `.mdx` files:
Includes `.js`, `.jsx`, `.ts` & `.tsx` by default. This option can be used to add fast refresh to `.mdx` files:

@@ -40,2 +40,18 @@ ```js

### exclude
The default value is `/node_modules/`. You may use it to exclude JSX/TSX files that runs in a worker or are not React files.
Except if explicitly desired, you should keep `node_modules` in the exclude list:
```js
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [
react({ exclude: [/\/pdf\//, /\.solid\.tsx$/, /\/node_modules\//] }),
],
})
```
### jsxImportSource

@@ -42,0 +58,0 @@