@vitejs/plugin-react 4.3.0 → 4.3.1
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 +6 -1
- package/dist/index.mjs +6 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -223,7 +223,7 @@ function viteReact(opts = {}) {
|
|
223
223
|
};
|
224
224
|
const dependencies = ["react", jsxImportDevRuntime, jsxImportRuntime];
|
225
225
|
const staticBabelPlugins = typeof opts.babel === "object" ? opts.babel?.plugins ?? [] : [];
|
226
|
-
if (
|
226
|
+
if (hasCompilerWithDefaultRuntime(staticBabelPlugins)) {
|
227
227
|
dependencies.push("react/compiler-runtime");
|
228
228
|
}
|
229
229
|
const viteReactRefresh = {
|
@@ -311,6 +311,11 @@ function hasCompiler(plugins) {
|
|
311
311
|
(p) => p === "babel-plugin-react-compiler" || Array.isArray(p) && p[0] === "babel-plugin-react-compiler"
|
312
312
|
);
|
313
313
|
}
|
314
|
+
function hasCompilerWithDefaultRuntime(plugins) {
|
315
|
+
return plugins.some(
|
316
|
+
(p) => p === "babel-plugin-react-compiler" || Array.isArray(p) && p[0] === "babel-plugin-react-compiler" && p[1]?.runtimeModule === void 0
|
317
|
+
);
|
318
|
+
}
|
314
319
|
|
315
320
|
module.exports = viteReact;
|
316
321
|
module.exports.default = viteReact;
|
package/dist/index.mjs
CHANGED
@@ -215,7 +215,7 @@ function viteReact(opts = {}) {
|
|
215
215
|
};
|
216
216
|
const dependencies = ["react", jsxImportDevRuntime, jsxImportRuntime];
|
217
217
|
const staticBabelPlugins = typeof opts.babel === "object" ? opts.babel?.plugins ?? [] : [];
|
218
|
-
if (
|
218
|
+
if (hasCompilerWithDefaultRuntime(staticBabelPlugins)) {
|
219
219
|
dependencies.push("react/compiler-runtime");
|
220
220
|
}
|
221
221
|
const viteReactRefresh = {
|
@@ -303,5 +303,10 @@ function hasCompiler(plugins) {
|
|
303
303
|
(p) => p === "babel-plugin-react-compiler" || Array.isArray(p) && p[0] === "babel-plugin-react-compiler"
|
304
304
|
);
|
305
305
|
}
|
306
|
+
function hasCompilerWithDefaultRuntime(plugins) {
|
307
|
+
return plugins.some(
|
308
|
+
(p) => p === "babel-plugin-react-compiler" || Array.isArray(p) && p[0] === "babel-plugin-react-compiler" && p[1]?.runtimeModule === void 0
|
309
|
+
);
|
310
|
+
}
|
306
311
|
|
307
312
|
export { viteReact as default };
|