-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
88 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,45 @@ | ||
--- | ||
"@remix-run/dev": patch | ||
"@remix-run/react": patch | ||
--- | ||
|
||
Vite: Replace <LiveReload/> with <DevScripts/> | ||
|
||
**This is a breaking change for projects using the unstable Vite plugin.** | ||
|
||
The `<LiveReload/>` component has a confusing name as it now also supports HMR and HDR. | ||
Additionally, it provides an bespoke client-side runtime that is obsoleted by Vite. | ||
To get our Vite plugin working, we were doing some compiler magic to swap out the | ||
implementation of `<LiveReload/>`. | ||
This was always meant as a temporary measure. | ||
|
||
Now we have a better solution in the form of a new `<DevScripts/>` component specifically | ||
designed with Vite's HMR capabilities in mind. | ||
|
||
The `<LiveReload />` component will cease to provide HMR and HDR capabilities in Vite, | ||
so you'll need to replace `<LiveReload/>` with `<DevScripts/>` in your app. | ||
|
||
The `<DevScripts/>` component should be placed in the `<head/>` of your app so that it | ||
can be loaded before any other scripts as required by React Fast Refresh. | ||
|
||
```diff | ||
import { | ||
- LiveReload, | ||
+ DevScripts, | ||
Outlet, | ||
} | ||
|
||
export default function App() { | ||
return ( | ||
<html> | ||
<head> | ||
+ <DevScripts /> | ||
</head> | ||
<body> | ||
- <LiveReload /> | ||
<Outlet /> | ||
</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