@vitejs/plugin-react
Advanced tools
+46
-4
@@ -83,2 +83,4 @@ import { dirname, join } from "node:path"; | ||
| let skipFastRefresh = true; | ||
| let base; | ||
| let isFullBundle = false; | ||
| let runPluginOverrides; | ||
@@ -123,2 +125,4 @@ let staticBabelOptions; | ||
| runningInVite = true; | ||
| base = config.base; | ||
| if (config.experimental.fullBundleMode) isFullBundle = true; | ||
| projectRoot = config.root; | ||
@@ -219,2 +223,22 @@ isProduction = config.isProduction; | ||
| apply: "serve", | ||
| async applyToEnvironment(env) { | ||
| if (env.config.consumer !== "client" || skipFastRefresh) return false; | ||
| let nativePlugin; | ||
| try { | ||
| nativePlugin = (await import("vite/internal")).reactRefreshWrapperPlugin; | ||
| } catch {} | ||
| if (!nativePlugin || [ | ||
| "7.1.10", | ||
| "7.1.11", | ||
| "7.1.12" | ||
| ].includes(vite.version)) return true; | ||
| delete viteRefreshWrapper.transform; | ||
| return nativePlugin({ | ||
| cwd: process.cwd(), | ||
| include: makeIdFiltersToMatchWithQuery(include), | ||
| exclude: makeIdFiltersToMatchWithQuery(exclude), | ||
| jsxImportSource, | ||
| reactRefreshHost: opts.reactRefreshHost ?? "" | ||
| }); | ||
| }, | ||
| transform: { | ||
@@ -245,2 +269,16 @@ filter: { id: { | ||
| }; | ||
| const viteReactRefreshFullBundleMode = { | ||
| name: "vite:react-refresh-fbm", | ||
| enforce: "pre", | ||
| transformIndexHtml: { | ||
| handler() { | ||
| if (!skipFastRefresh && isFullBundle) return [{ | ||
| tag: "script", | ||
| attrs: { type: "module" }, | ||
| children: getPreambleCode(base) | ||
| }]; | ||
| }, | ||
| order: "pre" | ||
| } | ||
| }; | ||
| const dependencies = [ | ||
@@ -277,7 +315,7 @@ "react", | ||
| }, | ||
| transformIndexHtml(_, config) { | ||
| if (!skipFastRefresh) return [{ | ||
| transformIndexHtml() { | ||
| if (!skipFastRefresh && !isFullBundle) return [{ | ||
| tag: "script", | ||
| attrs: { type: "module" }, | ||
| children: getPreambleCode(config.server.config.base) | ||
| children: getPreambleCode(base) | ||
| }]; | ||
@@ -288,3 +326,7 @@ } | ||
| viteBabel, | ||
| ...isRolldownVite ? [viteRefreshWrapper, viteConfigPost] : [], | ||
| ...isRolldownVite ? [ | ||
| viteRefreshWrapper, | ||
| viteConfigPost, | ||
| viteReactRefreshFullBundleMode | ||
| ] : [], | ||
| viteReactRefresh | ||
@@ -291,0 +333,0 @@ ]; |
+4
-4
| { | ||
| "name": "@vitejs/plugin-react", | ||
| "version": "5.0.3", | ||
| "version": "5.0.4", | ||
| "license": "MIT", | ||
@@ -46,3 +46,3 @@ "author": "Evan You", | ||
| "@babel/plugin-transform-react-jsx-source": "^7.27.1", | ||
| "@rolldown/pluginutils": "1.0.0-beta.35", | ||
| "@rolldown/pluginutils": "1.0.0-beta.38", | ||
| "@types/babel__core": "^7.20.5", | ||
@@ -59,6 +59,6 @@ "react-refresh": "^0.17.0" | ||
| "react-dom": "^19.1.1", | ||
| "rolldown": "1.0.0-beta.35", | ||
| "tsdown": "^0.14.2", | ||
| "rolldown": "1.0.0-beta.38", | ||
| "tsdown": "^0.15.4", | ||
| "vitest": "^3.2.4" | ||
| } | ||
| } |
+0
-4
@@ -130,6 +130,2 @@ # @vitejs/plugin-react [](https://npmjs.com/package/@vitejs/plugin-react) | ||
| ### disableOxcRecommendation | ||
| If set, disables the recommendation to use `@vitejs/plugin-react-oxc` (which is shown when `rolldown-vite` is detected and `babel` is not configured). | ||
| ## Consistent components exports | ||
@@ -136,0 +132,0 @@ |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
44188
2.09%1035
4.23%137
-2.84%+ Added
- Removed