Skip to content

Commit

Permalink
fix: revert throw when refresh runtime is loaded twice (fixes #234) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre authored Oct 19, 2024
1 parent 8c33a92 commit beb09db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions src/refresh-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit beb09db

Please sign in to comment.