From e272817cf30418f62b06bc69e22371f2b9c0f6b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Barr=C3=A9?= Date: Sun, 9 Apr 2023 03:48:15 +0200 Subject: [PATCH] fix: throw when refresh runtime is loaded twice --- src/refresh-runtime.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/refresh-runtime.js b/src/refresh-runtime.js index 80b962c..cbe001b 100644 --- a/src/refresh-runtime.js +++ b/src/refresh-runtime.js @@ -547,6 +547,12 @@ 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); }