Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/plugin-react/src/refreshUtils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/* eslint-disable no-undef */
if (typeof window !== 'undefined') {
if (window.__vite_plugin_react_runtime_loaded__) {
throw new Error(
'React refresh runtime was loaded twice. Maybe you forgot the base path?',
)
}
window.__vite_plugin_react_runtime_loaded__ = true
}

function debounce(fn, delay) {
let handle
return () => {
Expand All @@ -6,7 +16,6 @@ function debounce(fn, delay) {
}
}

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

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