@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 +1 -1
- package/dist/index.mjs +1 -1
- package/dist/refreshUtils.js +1 -10
- package/package.json +1 -1
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" ?
|
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" ?
|
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"),
|
package/dist/refreshUtils.js
CHANGED
@@ -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
|