@@ -1455,29 +1455,28 @@ function isEqualJson(v1: unknown, v2: unknown) {
1455
1455
}
1456
1456
1457
1457
function addRefreshWrapper (
1458
- pluginConfig : ResolvedVitePluginConfig ,
1458
+ remixConfig : ResolvedVitePluginConfig ,
1459
1459
code : string ,
1460
1460
id : string
1461
1461
) : string {
1462
- let isRoute =
1463
- id . endsWith ( CLIENT_ROUTE_QUERY_STRING ) || getRoute ( pluginConfig , id ) ;
1464
- let acceptExports = isRoute
1465
- ? [
1466
- "clientAction" ,
1467
- "clientLoader" ,
1468
- "handle" ,
1469
- "meta" ,
1470
- "links" ,
1471
- "shouldRevalidate" ,
1472
- ]
1473
- : [ ] ;
1462
+ let route = getRoute ( remixConfig , id ) ;
1463
+ let acceptExports =
1464
+ route || id . endsWith ( CLIENT_ROUTE_QUERY_STRING )
1465
+ ? [
1466
+ "clientAction" ,
1467
+ "clientLoader" ,
1468
+ "handle" ,
1469
+ "meta" ,
1470
+ "links" ,
1471
+ "shouldRevalidate" ,
1472
+ ]
1473
+ : [ ] ;
1474
1474
return (
1475
- REACT_REFRESH_HEADER . replace ( "__SOURCE__" , JSON . stringify ( id ) ) +
1475
+ REACT_REFRESH_HEADER . replaceAll ( "__SOURCE__" , JSON . stringify ( id ) ) +
1476
1476
code +
1477
- REACT_REFRESH_FOOTER . replace ( "__SOURCE__" , JSON . stringify ( id ) ) . replace (
1478
- "__ACCEPT_EXPORTS__" ,
1479
- JSON . stringify ( acceptExports )
1480
- )
1477
+ REACT_REFRESH_FOOTER . replaceAll ( "__SOURCE__" , JSON . stringify ( id ) )
1478
+ . replaceAll ( "__ACCEPT_EXPORTS__" , JSON . stringify ( acceptExports ) )
1479
+ . replaceAll ( "__ROUTE_ID__" , JSON . stringify ( route ?. id ) )
1481
1480
) ;
1482
1481
}
1483
1482
@@ -1511,6 +1510,7 @@ if (import.meta.hot && !inWebWorker && window.__remixLiveReloadEnabled) {
1511
1510
RefreshRuntime.registerExportsForReactRefresh(__SOURCE__, currentExports);
1512
1511
import.meta.hot.accept((nextExports) => {
1513
1512
if (!nextExports) return;
1513
+ __ROUTE_ID__ && window.__remixRouteModuleUpdates.set(__ROUTE_ID__, nextExports);
1514
1514
const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(currentExports, nextExports, __ACCEPT_EXPORTS__);
1515
1515
if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
1516
1516
});
0 commit comments