-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vite: no livereload, scripts injects hmr runtime instead
- Loading branch information
Showing
12 changed files
with
83 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
"@remix-run/dev": patch | ||
--- | ||
|
||
Vite: Remove interop with `<LiveReload />`, rely on `<Scripts />` instead | ||
|
||
**This is a breaking change for projects using the unstable Vite plugin.** | ||
|
||
For HMR and HDR to function, the React Fast Refresh preamble has to execute | ||
before any route modules. Having a separate component for dev scripts | ||
— `<LiveReload />` — implicitly relied on browser script execution order. | ||
This opened the door for race conditions that could only be avoided through hacks. | ||
|
||
Additionally, Vite comes with its own HMR runtime out-of-the-box, so much of the | ||
setup done within `<LiveReload />` became obsolete. | ||
|
||
To fix this, we now rely on `<Scripts />` to programmatically control execution | ||
order between dev preamble and route modules within a single script. | ||
|
||
```diff | ||
import { | ||
- LiveReload, | ||
Outlet, | ||
Scripts, | ||
} | ||
|
||
export default function App() { | ||
return ( | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<Outlet /> | ||
<Scripts /> | ||
- <LiveReload /> | ||
</body> | ||
</html> | ||
) | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters