Skip to content

Commit 7270aff

Browse files
authored
revert: throw when refresh runtime is loaded twice (#108) (fixes #193) (#194)
1 parent 7967375 commit 7270aff

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

packages/plugin-react/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Revert [#108](https://github.com/vitejs/vite-plugin-react/pull/108): Remove 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.
6+
57
## 4.0.2 (2023-07-06)
68

79
- Fix fast-refresh for files that are transformed into jsx ([#188](https://github.com/vitejs/vite-plugin-react/pull/188))

packages/plugin-react/src/refreshUtils.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
111
function debounce(fn, delay) {
122
let handle
133
return () => {
@@ -16,6 +6,7 @@ function debounce(fn, delay) {
166
}
177
}
188

9+
/* eslint-disable no-undef */
1910
const enqueueUpdate = debounce(exports.performReactRefresh, 16)
2011

2112
// Taken from https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/lib/runtime/RefreshUtils.js#L141

0 commit comments

Comments
 (0)