-
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
perf(vite): fix LiveReload proxy bailout logic #7883
Conversation
🦋 Changeset detectedLatest commit: e4d410c 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 |
import "./styles-bundled.css"; | ||
import linkedStyles from "./styles-linked.css?url"; | ||
import cssModulesStyles from "./styles.module.css"; | ||
"app/routes/_index.tsx": js` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fixing an unrelated issue with the test while I'm here. The template already contains app/routes/_index.tsx
, so we were adding a conflicting route with app/routes/_index/route.tsx
.
@@ -36,6 +36,9 @@ test.describe("Vite CSS dev", () => { | |||
port: ${devPort}, | |||
strictPort: true, | |||
}, | |||
optimizeDeps: { | |||
include: ["react", "react-dom/client", "@remix-run/react"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need this array defined so that we don't have multiple copies of these dependencies due to our project structure.
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
This fixes an issue raised by @dmarkow in #7868 (comment).
In the Vite dev server, we use a Babel transform to replace usage of
@remix-run/react
with a proxy module so that we can replace theLiveReload
component with a Vite-specific implementation. Since this transformation doesn't come for free, we first check whether the file contains references to@remix-run/react
andLiveReload
. This should mean that, even if the transformation could be faster, it's only applied to a single file in your app.However, there was an error in the boolean logic for this check that meant we were processing any file containing
@remix-run/react
, even if it was missing a reference toLiveReload
. This PR fixes the logic so that both strings need to be present, as intended.