From 04a615288c5a4211c7d83cfeb14fba14164d60f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Barr=C3=A9?= Date: Sat, 19 Oct 2024 18:04:01 +0200 Subject: [PATCH] fix: revert throw when refresh runtime is loaded twice --- CHANGELOG.md | 4 ++++ src/refresh-runtime.js | 6 ------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0461fbe..fa3296e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +Revert the throw when refresh runtime is loaded twice to enable usage in micro frontend apps. This was added to help fix setup usage, and this is not worth an annoying warning for others or a config parameter. + +This revert was done in the Babel plugin last year and I didn't port it back. + ## 3.7.1 Ignore directive sourcemap error [#231](https://github.com/vitejs/vite-plugin-react-swc/issues/231) diff --git a/src/refresh-runtime.js b/src/refresh-runtime.js index 6d34353..7f2e4be 100644 --- a/src/refresh-runtime.js +++ b/src/refresh-runtime.js @@ -547,12 +547,6 @@ function isLikelyComponentType(type) { * Plugin utils */ -if (window.$RefreshReg$) { - throw new Error( - "React refresh runtime was loaded twice. Maybe you forgot the base path?", - ); -} - export function getRefreshReg(filename) { return (type, id) => register(type, filename + " " + id); }