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

vite: no livereload, scripts injects hmr runtime instead #8636

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
39 changes: 39 additions & 0 deletions .changeset/ninety-turtles-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
"@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.**

Vite provides a robust client-side runtime for development features like HMR,
making the `<LiveReload />` component obsolete.

In fact, having a separate dev scripts component was causing issues with script execution order.
To work around this, the Remix Vite plugin used to override `<LiveReload />` into a bespoke
implementation that was compatible with Vite.

Instead of all this indirection, now the Remix Vite plugin instructs the `<Scripts />` component
to automatically include Vite's client-side runtime and other dev-only scripts.

```diff
import {
- LiveReload,
Outlet,
Scripts,
}

export default function App() {
return (
<html>
<head>
</head>
<body>
<Outlet />
<Scripts />
- <LiveReload />
</body>
</html>
)
}
```
30 changes: 30 additions & 0 deletions docs/future/vite.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,36 @@ export default defineConfig({
});
```

#### HMR & HDR

Vite provides a robust client-side runtime for development features like HMR,
making the `<LiveReload />` component obsolete. When using the Remix Vite plugin in development,
the `<Scripts />` component will automatically include Vite's client-side runtime and other dev-only scripts.

👉 **Remove `<LiveReload/>`, keep `<Scripts />`**

```diff
import {
- LiveReload,
Outlet,
Scripts,
}

export default function App() {
return (
<html>
<head>
</head>
<body>
<Outlet />
- <LiveReload />
<Scripts />
</body>
</html>
)
}
```

#### TypeScript integration

Vite handles imports for all sorts of different file types, sometimes in ways that differ from the existing Remix compiler, so let's reference Vite's types from `vite/client` instead of the obsolete types from `@remix-run/dev`.
Expand Down
2 changes: 0 additions & 2 deletions integration/helpers/vite-template/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
Expand All @@ -20,7 +19,6 @@ export default function App() {
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
Expand Down
3 changes: 1 addition & 2 deletions integration/vite-css-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const files = {
});
`,
"app/root.tsx": `
import { Links, Meta, Outlet, Scripts, LiveReload } from "@remix-run/react";
import { Links, Meta, Outlet, Scripts } from "@remix-run/react";

export default function Root() {
return (
Expand All @@ -46,7 +46,6 @@ const files = {
<body>
<Outlet />
<Scripts />
<LiveReload />
</body>
</html>
);
Expand Down
6 changes: 1 addition & 5 deletions integration/vite-dev-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test.describe("Vite dev", () => {
});
`,
"app/root.tsx": js`
import { Links, Meta, Outlet, Scripts, LiveReload } from "@remix-run/react";
import { Links, Meta, Outlet, Scripts } from "@remix-run/react";

export default function Root() {
return (
Expand All @@ -55,7 +55,6 @@ test.describe("Vite dev", () => {
<Outlet />
</div>
<Scripts />
<LiveReload nonce="1234" />
</body>
</html>
);
Expand Down Expand Up @@ -330,9 +329,6 @@ test.describe("Vite dev", () => {
await expect(hmrStatus).toHaveText("HMR updated: yes");
await expect(input).toHaveValue("stateful");

// check LiveReload script has nonce
await expect(page.locator(`script[nonce="1234"]`)).toBeAttached();

// Ensure no errors after HMR
expect(pageErrors).toEqual([]);
});
Expand Down
3 changes: 1 addition & 2 deletions integration/vite-server-bundles-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const TEST_ROUTES = [
const files = {
"app/root.tsx": `
${ROUTE_FILE_COMMENT}
import { Links, Meta, Outlet, Scripts, LiveReload } from "@remix-run/react";
import { Links, Meta, Outlet, Scripts } from "@remix-run/react";

export default function Root() {
return (
Expand All @@ -86,7 +86,6 @@ const files = {
<body>
<Outlet />
<Scripts />
<LiveReload />
</body>
</html>
);
Expand Down
53 changes: 2 additions & 51 deletions packages/remix-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import { getStylesForUrl, isCssModulesFile } from "./styles";
import * as VirtualModule from "./vmod";
import { resolveFileUrl } from "./resolve-file-url";
import { removeExports } from "./remove-exports";
import { replaceImportSpecifier } from "./replace-import-specifier";
import { importViteEsmSync, preloadViteEsm } from "./import-vite-esm-sync";

const supportedRemixEsbuildConfigKeys = [
Expand Down Expand Up @@ -227,7 +226,6 @@ export type RemixPluginContext = RemixPluginSsrBuildContext & {
let serverBuildId = VirtualModule.id("server-build");
let serverManifestId = VirtualModule.id("server-manifest");
let browserManifestId = VirtualModule.id("browser-manifest");
let remixReactProxyId = VirtualModule.id("remix-react-proxy");
let hmrRuntimeId = VirtualModule.id("hmr-runtime");
let injectHmrRuntimeId = VirtualModule.id("inject-hmr-runtime");

Expand Down Expand Up @@ -1290,53 +1288,6 @@ export const remixVitePlugin: RemixVitePlugin = (remixUserConfig = {}) => {
};
},
},
{
name: "remix-remix-react-proxy",
resolveId(id) {
if (id === remixReactProxyId) {
return VirtualModule.resolve(remixReactProxyId);
}
},
transform(code, id) {
// Don't transform the proxy itself, otherwise it will import itself
if (id === VirtualModule.resolve(remixReactProxyId)) {
return;
}

let hasLiveReloadHints =
code.includes("LiveReload") && code.includes("@remix-run/react");

// Don't transform files that don't need the proxy
if (!hasLiveReloadHints) {
return;
}

// Rewrite imports to use the proxy
return replaceImportSpecifier({
code,
specifier: "@remix-run/react",
replaceWith: remixReactProxyId,
});
},
load(id) {
if (id === VirtualModule.resolve(remixReactProxyId)) {
// TODO: ensure react refresh is initialized before `<Scripts />`
return [
'import { createElement } from "react";',
'export * from "@remix-run/react";',
`export const LiveReload = ${
viteCommand !== "serve"
} ? () => null : `,
'({ nonce = undefined }) => createElement("script", {',
" nonce,",
" dangerouslySetInnerHTML: { ",
" __html: `window.__remixLiveReloadEnabled = true`",
" }",
"});",
].join("\n");
}
},
},
Comment on lines -1293 to -1339
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

{
name: "remix-inject-hmr-runtime",
enforce: "pre",
Expand Down Expand Up @@ -1512,7 +1463,7 @@ const inWebWorker = typeof WorkerGlobalScope !== 'undefined' && self instanceof
let prevRefreshReg;
let prevRefreshSig;

if (import.meta.hot && !inWebWorker && window.__remixLiveReloadEnabled) {
if (import.meta.hot && !inWebWorker) {
if (!window.__vite_plugin_react_preamble_installed__) {
throw new Error(
"Remix Vite plugin can't detect preamble. Something is wrong."
Expand All @@ -1528,7 +1479,7 @@ if (import.meta.hot && !inWebWorker && window.__remixLiveReloadEnabled) {
}`.replace(/\n+/g, "");

const REACT_REFRESH_FOOTER = `
if (import.meta.hot && !inWebWorker && window.__remixLiveReloadEnabled) {
if (import.meta.hot && !inWebWorker) {
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;
RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
Expand Down
26 changes: 0 additions & 26 deletions packages/remix-dev/vite/replace-import-specifier.ts

This file was deleted.

16 changes: 15 additions & 1 deletion packages/remix-react/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@
process.env.NODE_ENV !== "development"
? () => null
: function LiveReload({
origin = process.env.REMIX_DEV_ORIGIN,
origin,
port,
timeoutMs = 1000,
nonce = undefined,
Expand All @@ -1083,6 +1083,20 @@
timeoutMs?: number;
nonce?: string;
}) {
// @ts-expect-error
let isViteClient = import.meta.env !== undefined;

Check failure on line 1087 in packages/remix-react/components.tsx

View workflow job for this annotation

GitHub Actions / 🧪 Unit Test / ubuntu-latest / node@20.5.1

<LiveReload /> › development environment › defaults the origin to REMIX_DEV_ORIGIN env variable

TypeError: Cannot read properties of undefined (reading 'env') at env (components.tsx:1087:40) at renderWithHooks (../../node_modules/react-dom/cjs/react-dom.development.js:16305:18) at mountIndeterminateComponent (../../node_modules/react-dom/cjs/react-dom.development.js:20074:13) at beginWork (../../node_modules/react-dom/cjs/react-dom.development.js:21587:16) at beginWork$1 (../../node_modules/react-dom/cjs/react-dom.development.js:27426:14) at performUnitOfWork (../../node_modules/react-dom/cjs/react-dom.development.js:26560:12) at workLoopSync (../../node_modules/react-dom/cjs/react-dom.development.js:26466:5) at renderRootSync (../../node_modules/react-dom/cjs/react-dom.development.js:26434:7) at recoverFromConcurrentError (../../node_modules/react-dom/cjs/react-dom.development.js:25850:20) at performConcurrentWorkOnRoot (../../node_modules/react-dom/cjs/react-dom.development.js:25750:22) at flushActQueue (../../node_modules/react/cjs/react.development.js:2667:24) at act (../../node_modules/react/cjs/react.development.js:2582:11) at ../../node_modules/@testing-library/react/dist/act-compat.js:63:25 at renderRoot (../../node_modules/@testing-library/react/dist/pure.js:159:26) at render (../../node_modules/@testing-library/react/dist/pure.js:246:10) at Object.<anonymous> (__tests__/components-test.tsx:53:33)

Check failure on line 1087 in packages/remix-react/components.tsx

View workflow job for this annotation

GitHub Actions / 🧪 Unit Test / ubuntu-latest / node@20.5.1

<LiveReload /> › development environment › can set the origin explicitly

TypeError: Cannot read properties of undefined (reading 'env') at env (components.tsx:1087:40) at renderWithHooks (../../node_modules/react-dom/cjs/react-dom.development.js:16305:18) at mountIndeterminateComponent (../../node_modules/react-dom/cjs/react-dom.development.js:20074:13) at beginWork (../../node_modules/react-dom/cjs/react-dom.development.js:21587:16) at beginWork$1 (../../node_modules/react-dom/cjs/react-dom.development.js:27426:14) at performUnitOfWork (../../node_modules/react-dom/cjs/react-dom.development.js:26560:12) at workLoopSync (../../node_modules/react-dom/cjs/react-dom.development.js:26466:5) at renderRootSync (../../node_modules/react-dom/cjs/react-dom.development.js:26434:7) at recoverFromConcurrentError (../../node_modules/react-dom/cjs/react-dom.development.js:25850:20) at performConcurrentWorkOnRoot (../../node_modules/react-dom/cjs/react-dom.development.js:25750:22) at flushActQueue (../../node_modules/react/cjs/react.development.js:2667:24) at act (../../node_modules/react/cjs/react.development.js:2582:11) at ../../node_modules/@testing-library/react/dist/act-compat.js:63:25 at renderRoot (../../node_modules/@testing-library/react/dist/pure.js:159:26) at render (../../node_modules/@testing-library/react/dist/pure.js:246:10) at Object.<anonymous> (__tests__/components-test.tsx:62:33)

Check failure on line 1087 in packages/remix-react/components.tsx

View workflow job for this annotation

GitHub Actions / 🧪 Unit Test / ubuntu-latest / node@20.5.1

<LiveReload /> › development environment › defaults the port to 8002

TypeError: Cannot read properties of undefined (reading 'env') at env (components.tsx:1087:40) at renderWithHooks (../../node_modules/react-dom/cjs/react-dom.development.js:16305:18) at mountIndeterminateComponent (../../node_modules/react-dom/cjs/react-dom.development.js:20074:13) at beginWork (../../node_modules/react-dom/cjs/react-dom.development.js:21587:16) at beginWork$1 (../../node_modules/react-dom/cjs/react-dom.development.js:27426:14) at performUnitOfWork (../../node_modules/react-dom/cjs/react-dom.development.js:26560:12) at workLoopSync (../../node_modules/react-dom/cjs/react-dom.development.js:26466:5) at renderRootSync (../../node_modules/react-dom/cjs/react-dom.development.js:26434:7) at recoverFromConcurrentError (../../node_modules/react-dom/cjs/react-dom.development.js:25850:20) at performConcurrentWorkOnRoot (../../node_modules/react-dom/cjs/react-dom.development.js:25750:22) at flushActQueue (../../node_modules/react/cjs/react.development.js:2667:24) at act (../../node_modules/react/cjs/react.development.js:2582:11) at ../../node_modules/@testing-library/react/dist/act-compat.js:63:25 at renderRoot (../../node_modules/@testing-library/react/dist/pure.js:159:26) at render (../../node_modules/@testing-library/react/dist/pure.js:246:10) at Object.<anonymous> (__tests__/components-test.tsx:70:33)

Check failure on line 1087 in packages/remix-react/components.tsx

View workflow job for this annotation

GitHub Actions / 🧪 Unit Test / ubuntu-latest / node@20.5.1

<LiveReload /> › development environment › can set the port explicitly

TypeError: Cannot read properties of undefined (reading 'env') at env (components.tsx:1087:40) at renderWithHooks (../../node_modules/react-dom/cjs/react-dom.development.js:16305:18) at mountIndeterminateComponent (../../node_modules/react-dom/cjs/react-dom.development.js:20074:13) at beginWork (../../node_modules/react-dom/cjs/react-dom.development.js:21587:16) at beginWork$1 (../../node_modules/react-dom/cjs/react-dom.development.js:27426:14) at performUnitOfWork (../../node_modules/react-dom/cjs/react-dom.development.js:26560:12) at workLoopSync (../../node_modules/react-dom/cjs/react-dom.development.js:26466:5) at renderRootSync (../../node_modules/react-dom/cjs/react-dom.development.js:26434:7) at recoverFromConcurrentError (../../node_modules/react-dom/cjs/react-dom.development.js:25850:20) at performConcurrentWorkOnRoot (../../node_modules/react-dom/cjs/react-dom.development.js:25750:22) at flushActQueue (../../node_modules/react/cjs/react.development.js:2667:24) at act (../../node_modules/react/cjs/react.development.js:2582:11) at ../../node_modules/@testing-library/react/dist/act-compat.js:63:25 at renderRoot (../../node_modules/@testing-library/react/dist/pure.js:159:26) at render (../../node_modules/@testing-library/react/dist/pure.js:246:10) at Object.<anonymous> (__tests__/components-test.tsx:77:33)

Check failure on line 1087 in packages/remix-react/components.tsx

View workflow job for this annotation

GitHub Actions / 🧪 Unit Test / ubuntu-latest / node@20.5.1

<LiveReload /> › development environment › timeout of reload is set to 200ms

TypeError: Cannot read properties of undefined (reading 'env') at env (components.tsx:1087:40) at renderWithHooks (../../node_modules/react-dom/cjs/react-dom.development.js:16305:18) at mountIndeterminateComponent (../../node_modules/react-dom/cjs/react-dom.development.js:20074:13) at beginWork (../../node_modules/react-dom/cjs/react-dom.development.js:21587:16) at beginWork$1 (../../node_modules/react-dom/cjs/react-dom.development.js:27426:14) at performUnitOfWork (../../node_modules/react-dom/cjs/react-dom.development.js:26560:12) at workLoopSync (../../node_modules/react-dom/cjs/react-dom.development.js:26466:5) at renderRootSync (../../node_modules/react-dom/cjs/react-dom.development.js:26434:7) at recoverFromConcurrentError (../../node_modules/react-dom/cjs/react-dom.development.js:25850:20) at performConcurrentWorkOnRoot (../../node_modules/react-dom/cjs/react-dom.development.js:25750:22) at flushActQueue (../../node_modules/react/cjs/react.development.js:2667:24) at act (../../node_modules/react/cjs/react.development.js:2582:11) at ../../node_modules/@testing-library/react/dist/act-compat.js:63:25 at renderRoot (../../node_modules/@testing-library/react/dist/pure.js:159:26) at render (../../node_modules/@testing-library/react/dist/pure.js:246:10) at Object.<anonymous> (__tests__/components-test.tsx:85:33)

Check failure on line 1087 in packages/remix-react/components.tsx

View workflow job for this annotation

GitHub Actions / 🧪 Unit Test / windows-latest / node@20.5.1

<LiveReload /> › development environment › defaults the origin to REMIX_DEV_ORIGIN env variable

TypeError: Cannot read properties of undefined (reading 'env') at env (components.tsx:1087:40) at renderWithHooks (../../node_modules/react-dom/cjs/react-dom.development.js:16305:18) at mountIndeterminateComponent (../../node_modules/react-dom/cjs/react-dom.development.js:20074:13) at beginWork (../../node_modules/react-dom/cjs/react-dom.development.js:21587:16) at beginWork$1 (../../node_modules/react-dom/cjs/react-dom.development.js:27426:14) at performUnitOfWork (../../node_modules/react-dom/cjs/react-dom.development.js:26560:12) at workLoopSync (../../node_modules/react-dom/cjs/react-dom.development.js:26466:5) at renderRootSync (../../node_modules/react-dom/cjs/react-dom.development.js:26434:7) at recoverFromConcurrentError (../../node_modules/react-dom/cjs/react-dom.development.js:25850:20) at performConcurrentWorkOnRoot (../../node_modules/react-dom/cjs/react-dom.development.js:25750:22) at flushActQueue (../../node_modules/react/cjs/react.development.js:2667:24) at act (../../node_modules/react/cjs/react.development.js:2582:11) at ../../node_modules/@testing-library/react/dist/act-compat.js:63:25 at renderRoot (../../node_modules/@testing-library/react/dist/pure.js:159:26) at render (../../node_modules/@testing-library/react/dist/pure.js:246:10) at Object.<anonymous> (__tests__/components-test.tsx:53:33)

Check failure on line 1087 in packages/remix-react/components.tsx

View workflow job for this annotation

GitHub Actions / 🧪 Unit Test / windows-latest / node@20.5.1

<LiveReload /> › development environment › can set the origin explicitly

TypeError: Cannot read properties of undefined (reading 'env') at env (components.tsx:1087:40) at renderWithHooks (../../node_modules/react-dom/cjs/react-dom.development.js:16305:18) at mountIndeterminateComponent (../../node_modules/react-dom/cjs/react-dom.development.js:20074:13) at beginWork (../../node_modules/react-dom/cjs/react-dom.development.js:21587:16) at beginWork$1 (../../node_modules/react-dom/cjs/react-dom.development.js:27426:14) at performUnitOfWork (../../node_modules/react-dom/cjs/react-dom.development.js:26560:12) at workLoopSync (../../node_modules/react-dom/cjs/react-dom.development.js:26466:5) at renderRootSync (../../node_modules/react-dom/cjs/react-dom.development.js:26434:7) at recoverFromConcurrentError (../../node_modules/react-dom/cjs/react-dom.development.js:25850:20) at performConcurrentWorkOnRoot (../../node_modules/react-dom/cjs/react-dom.development.js:25750:22) at flushActQueue (../../node_modules/react/cjs/react.development.js:2667:24) at act (../../node_modules/react/cjs/react.development.js:2582:11) at ../../node_modules/@testing-library/react/dist/act-compat.js:63:25 at renderRoot (../../node_modules/@testing-library/react/dist/pure.js:159:26) at render (../../node_modules/@testing-library/react/dist/pure.js:246:10) at Object.<anonymous> (__tests__/components-test.tsx:62:33)

Check failure on line 1087 in packages/remix-react/components.tsx

View workflow job for this annotation

GitHub Actions / 🧪 Unit Test / windows-latest / node@20.5.1

<LiveReload /> › development environment › defaults the port to 8002

TypeError: Cannot read properties of undefined (reading 'env') at env (components.tsx:1087:40) at renderWithHooks (../../node_modules/react-dom/cjs/react-dom.development.js:16305:18) at mountIndeterminateComponent (../../node_modules/react-dom/cjs/react-dom.development.js:20074:13) at beginWork (../../node_modules/react-dom/cjs/react-dom.development.js:21587:16) at beginWork$1 (../../node_modules/react-dom/cjs/react-dom.development.js:27426:14) at performUnitOfWork (../../node_modules/react-dom/cjs/react-dom.development.js:26560:12) at workLoopSync (../../node_modules/react-dom/cjs/react-dom.development.js:26466:5) at renderRootSync (../../node_modules/react-dom/cjs/react-dom.development.js:26434:7) at recoverFromConcurrentError (../../node_modules/react-dom/cjs/react-dom.development.js:25850:20) at performConcurrentWorkOnRoot (../../node_modules/react-dom/cjs/react-dom.development.js:25750:22) at flushActQueue (../../node_modules/react/cjs/react.development.js:2667:24) at act (../../node_modules/react/cjs/react.development.js:2582:11) at ../../node_modules/@testing-library/react/dist/act-compat.js:63:25 at renderRoot (../../node_modules/@testing-library/react/dist/pure.js:159:26) at render (../../node_modules/@testing-library/react/dist/pure.js:246:10) at Object.<anonymous> (__tests__/components-test.tsx:70:33)

Check failure on line 1087 in packages/remix-react/components.tsx

View workflow job for this annotation

GitHub Actions / 🧪 Unit Test / windows-latest / node@20.5.1

<LiveReload /> › development environment › can set the port explicitly

TypeError: Cannot read properties of undefined (reading 'env') at env (components.tsx:1087:40) at renderWithHooks (../../node_modules/react-dom/cjs/react-dom.development.js:16305:18) at mountIndeterminateComponent (../../node_modules/react-dom/cjs/react-dom.development.js:20074:13) at beginWork (../../node_modules/react-dom/cjs/react-dom.development.js:21587:16) at beginWork$1 (../../node_modules/react-dom/cjs/react-dom.development.js:27426:14) at performUnitOfWork (../../node_modules/react-dom/cjs/react-dom.development.js:26560:12) at workLoopSync (../../node_modules/react-dom/cjs/react-dom.development.js:26466:5) at renderRootSync (../../node_modules/react-dom/cjs/react-dom.development.js:26434:7) at recoverFromConcurrentError (../../node_modules/react-dom/cjs/react-dom.development.js:25850:20) at performConcurrentWorkOnRoot (../../node_modules/react-dom/cjs/react-dom.development.js:25750:22) at flushActQueue (../../node_modules/react/cjs/react.development.js:2667:24) at act (../../node_modules/react/cjs/react.development.js:2582:11) at ../../node_modules/@testing-library/react/dist/act-compat.js:63:25 at renderRoot (../../node_modules/@testing-library/react/dist/pure.js:159:26) at render (../../node_modules/@testing-library/react/dist/pure.js:246:10) at Object.<anonymous> (__tests__/components-test.tsx:77:33)

Check failure on line 1087 in packages/remix-react/components.tsx

View workflow job for this annotation

GitHub Actions / 🧪 Unit Test / windows-latest / node@20.5.1

<LiveReload /> › development environment › timeout of reload is set to 200ms

TypeError: Cannot read properties of undefined (reading 'env') at env (components.tsx:1087:40) at renderWithHooks (../../node_modules/react-dom/cjs/react-dom.development.js:16305:18) at mountIndeterminateComponent (../../node_modules/react-dom/cjs/react-dom.development.js:20074:13) at beginWork (../../node_modules/react-dom/cjs/react-dom.development.js:21587:16) at beginWork$1 (../../node_modules/react-dom/cjs/react-dom.development.js:27426:14) at performUnitOfWork (../../node_modules/react-dom/cjs/react-dom.development.js:26560:12) at workLoopSync (../../node_modules/react-dom/cjs/react-dom.development.js:26466:5) at renderRootSync (../../node_modules/react-dom/cjs/react-dom.development.js:26434:7) at recoverFromConcurrentError (../../node_modules/react-dom/cjs/react-dom.development.js:25850:20) at performConcurrentWorkOnRoot (../../node_modules/react-dom/cjs/react-dom.development.js:25750:22) at flushActQueue (../../node_modules/react/cjs/react.development.js:2667:24) at act (../../node_modules/react/cjs/react.development.js:2582:11) at ../../node_modules/@testing-library/react/dist/act-compat.js:63:25 at renderRoot (../../node_modules/@testing-library/react/dist/pure.js:159:26) at render (../../node_modules/@testing-library/react/dist/pure.js:246:10) at Object.<anonymous> (__tests__/components-test.tsx:85:33)
if (isViteClient) {
console.warn(
[
"`<LiveReload />` is obsolete when using Vite and can conflict with Vite's built-in HMR runtime.",
"",
"Remove `<LiveReload />` from your code and instead only use `<Scripts />`.",
"Then refresh the page to remove lingering scripts from `<LiveReload />`.",
].join("\n")
);
}
// @ts-expect-error
origin ??= import.meta.env ? "" : process.env.REMIX_DEV_ORIGIN;
let js = String.raw;
return (
<script
Expand Down
3 changes: 0 additions & 3 deletions templates/spa/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
Expand All @@ -20,7 +19,6 @@ export default function App() {
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
Expand All @@ -38,7 +36,6 @@ export function HydrateFallback() {
<body>
<p>Loading...</p>
<Scripts />
<LiveReload />
</body>
</html>
);
Expand Down
2 changes: 0 additions & 2 deletions templates/unstable-vite-cloudflare/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
Expand All @@ -20,7 +19,6 @@ export default function App() {
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
Expand Down
2 changes: 0 additions & 2 deletions templates/unstable-vite-express/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
Expand All @@ -20,7 +19,6 @@ export default function App() {
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
Expand Down
2 changes: 0 additions & 2 deletions templates/unstable-vite/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
Expand All @@ -20,7 +19,6 @@ export default function App() {
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
Expand Down
Loading