-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vite: replace <LiveReload/>
with <DevScripts/>
#8609
Conversation
f2a9998
to
80feb71
Compare
🦋 Changeset detectedLatest commit: d0d8428 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
4db4fc6
to
ca95b24
Compare
ca95b24
to
d0d8428
Compare
Alternative would be to have something like: import {
- LiveReload,
Scripts,
Outlet,
}
export default function App() {
return (
<html>
<body>
- <LiveReload />
<Scripts />
<Outlet />
</body>
</html>
)
} Where |
Superceded by #8636 |
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 specificallydesigned 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 itcan be loaded before any other scripts as required by React Fast Refresh.
Tried to directly inject the HMR runtime into the
<head/>
instead (#8604) but that still had issues with race conditions.