diff --git a/plugins/plugin-react-refresh/plugin.js b/plugins/plugin-react-refresh/plugin.js
index 76bb1a0a63..b9f4bf9222 100644
--- a/plugins/plugin-react-refresh/plugin.js
+++ b/plugins/plugin-react-refresh/plugin.js
@@ -14,8 +14,9 @@ const reactRefreshCode = fs
function transformHtml(contents) {
return contents.replace(
- /
/s,
- `$&
+ /(.*)()(.*)/s,
+ function (match, p1, p2, p3) {
+ return `${p1}${p2}
`,
+${p3}`
+ },
);
}
diff --git a/plugins/plugin-react-refresh/test/__snapshots__/plugin.test.js.snap b/plugins/plugin-react-refresh/test/__snapshots__/plugin.test.js.snap
index 1aad937918..4e27a0bd9b 100644
--- a/plugins/plugin-react-refresh/test/__snapshots__/plugin.test.js.snap
+++ b/plugins/plugin-react-refresh/test/__snapshots__/plugin.test.js.snap
@@ -370,7 +370,7 @@ function register(type, id) {
allFamiliesByType.set(type, family); // Visit inner types because we might not have registered them.
if (typeof type === 'object' && type !== null) {
- switch (type.$typeof) {
+ switch (type.$$typeof) {
case REACT_FORWARD_REF_TYPE:
register(type.render, id + '$render');
break;
@@ -653,7 +653,7 @@ function isLikelyComponentType(type) {
case 'object':
{
if (type != null) {
- switch (type.$typeof) {
+ switch (type.$$typeof) {
case REACT_FORWARD_REF_TYPE:
case REACT_MEMO_TYPE:
// Definitely React components.
@@ -1083,7 +1083,7 @@ function register(type, id) {
allFamiliesByType.set(type, family); // Visit inner types because we might not have registered them.
if (typeof type === 'object' && type !== null) {
- switch (type.$typeof) {
+ switch (type.$$typeof) {
case REACT_FORWARD_REF_TYPE:
register(type.render, id + '$render');
break;
@@ -1366,7 +1366,7 @@ function isLikelyComponentType(type) {
case 'object':
{
if (type != null) {
- switch (type.$typeof) {
+ switch (type.$$typeof) {
case REACT_FORWARD_REF_TYPE:
case REACT_MEMO_TYPE:
// Definitely React components.
@@ -1785,7 +1785,7 @@ function register(type, id) {
allFamiliesByType.set(type, family); // Visit inner types because we might not have registered them.
if (typeof type === 'object' && type !== null) {
- switch (type.$typeof) {
+ switch (type.$$typeof) {
case REACT_FORWARD_REF_TYPE:
register(type.render, id + '$render');
break;
@@ -2068,7 +2068,7 @@ function isLikelyComponentType(type) {
case 'object':
{
if (type != null) {
- switch (type.$typeof) {
+ switch (type.$$typeof) {
case REACT_FORWARD_REF_TYPE:
case REACT_MEMO_TYPE:
// Definitely React components.