Skip to content

Commit 82b45c3

Browse files
committed
fix: avoid key collision in React refresh registration (fix #116)
1 parent 11a9961 commit 82b45c3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/plugin-react/src/refreshUtils.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ function registerExportsForReactRefresh(filename, moduleExports) {
2525
if (key === '__esModule') continue
2626
const exportValue = moduleExports[key]
2727
if (exports.isLikelyComponentType(exportValue)) {
28-
exports.register(exportValue, filename + ' ' + key)
28+
// `export` is required to avoid key collision when renamed export shadow local component name
29+
// https://github.com/vitejs/vite-plugin-react/issues/116
30+
exports.register(exportValue, filename + ' export ' + key)
2931
}
3032
}
3133
}

0 commit comments

Comments
 (0)