@vitejs/plugin-react 4.0.1 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -155,7 +155,7 @@ function viteReact(opts = {}) {
155
155
  })();
156
156
  const plugins = [...babelOptions.plugins];
157
157
  const isJSX = filepath.endsWith("x");
158
- const useFastRefresh = !skipFastRefresh && !ssr && (isJSX || (opts.jsxRuntime === "classic" ? code.includes(devRuntime) : importReactRE.test(code)));
158
+ const useFastRefresh = !skipFastRefresh && !ssr && (isJSX || (opts.jsxRuntime === "classic" ? importReactRE.test(code) : code.includes(devRuntime)));
159
159
  if (useFastRefresh) {
160
160
  plugins.push([
161
161
  await loadPlugin("react-refresh/babel"),
package/dist/index.mjs CHANGED
@@ -135,7 +135,7 @@ function viteReact(opts = {}) {
135
135
  })();
136
136
  const plugins = [...babelOptions.plugins];
137
137
  const isJSX = filepath.endsWith("x");
138
- const useFastRefresh = !skipFastRefresh && !ssr && (isJSX || (opts.jsxRuntime === "classic" ? code.includes(devRuntime) : importReactRE.test(code)));
138
+ const useFastRefresh = !skipFastRefresh && !ssr && (isJSX || (opts.jsxRuntime === "classic" ? importReactRE.test(code) : code.includes(devRuntime)));
139
139
  if (useFastRefresh) {
140
140
  plugins.push([
141
141
  await loadPlugin("react-refresh/babel"),
@@ -1,13 +1,3 @@
1
- /* eslint-disable no-undef */
2
- if (typeof window !== 'undefined') {
3
- if (window.__vite_plugin_react_runtime_loaded__) {
4
- throw new Error(
5
- 'React refresh runtime was loaded twice. Maybe you forgot the base path?',
6
- )
7
- }
8
- window.__vite_plugin_react_runtime_loaded__ = true
9
- }
10
-
11
1
  function debounce(fn, delay) {
12
2
  let handle
13
3
  return () => {
@@ -16,6 +6,7 @@ function debounce(fn, delay) {
16
6
  }
17
7
  }
18
8
 
9
+ /* eslint-disable no-undef */
19
10
  const enqueueUpdate = debounce(exports.performReactRefresh, 16)
20
11
 
21
12
  // Taken from https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/lib/runtime/RefreshUtils.js#L141
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitejs/plugin-react",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "license": "MIT",
5
5
  "author": "Evan You",
6
6
  "contributors": [