Skip to content
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

Support Remix HMR v2 #1187

Merged
merged 24 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .changeset/heavy-rockets-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
'@shopify/cli-hydrogen': minor
'@shopify/demo-store': minor
---

Support Remix Hot Module Replacement (HMR) and Hot Data Revalidation (HDR).
Start using it with the following changes to your project:

1. Upgrade to the latest Hydrogen version and Remix 1.19.1.

2. Enable the v2 dev server in `remix.config.js`:

```diff
// ...
future: {
+ v2_dev: true,
v2_meta: true,
v2_headers: true,
// ...
}
```

3. Add Remix' `<LiveReload />` component if you don't have it to your `root.jsx` or `root.tsx` file:

```diff
import {
Outlet,
Scripts,
+ LiveReload,
ScrollRestoration,
} from '@remix-run/react';

// ...

export default function App() {
// ...

return (
<html>
<head>
{/* ... */}
</head>
<body>
<Outlet />
<ScrollRestoration />
<Scripts />
+ <LiveReload />
</body>
</html>
);
}

export function ErrorBoundary() {
// ...

return (
<html>
<head>
{/* ... */}
</head>
<body>
Error!
<Scripts />
+ <LiveReload />
</body>
</html>
);
}
```
2 changes: 2 additions & 0 deletions examples/customer-api/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Meta,
Outlet,
Scripts,
LiveReload,
ScrollRestoration,
useLoaderData,
} from '@remix-run/react';
Expand Down Expand Up @@ -52,6 +53,7 @@ export default function App() {
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
Expand Down
1 change: 1 addition & 0 deletions examples/customer-api/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
serverPlatform: 'neutral',
serverMinify: process.env.NODE_ENV === 'production',
future: {
v2_dev: true,
v2_meta: true,
v2_headers: true,
v2_errorBoundary: true,
Expand Down
2 changes: 2 additions & 0 deletions examples/express/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Meta,
Outlet,
Scripts,
LiveReload,
ScrollRestoration,
useLoaderData,
} from '@remix-run/react';
Expand Down Expand Up @@ -80,6 +81,7 @@ export default function App() {
</Layout>
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
Expand Down
1 change: 1 addition & 0 deletions examples/express/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
// publicPath: "/build/",
serverModuleFormat: 'cjs',
future: {
v2_dev: true,
v2_meta: true,
v2_headers: true,
v2_errorBoundary: true,
Expand Down
Loading
Loading