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

Add Vite v6 support #10351

Open
wants to merge 17 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changeset/lovely-files-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": minor
---

Add Vite v6 support
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tsconfig.tsbuildinfo
/fixtures/my-remix-app
/fixtures/deno-app
/integration/playwright-report
/test-results
test-results
Copy link
Member Author

Choose a reason for hiding this comment

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

I noticed the test-results directory within integration was showing up in my git diffs.

/uploads

.eslintcache
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The Remix CLI will not perform any type checking. Instead, you'll want to use Ty
"@types/react-dom": "^18.2.7",
"eslint": "^8.23.1",
"typescript": "^5.1.6",
"vite": "^5.1.4"
"vite": "^6.0.0"
},
"engines": {
"node": ">=18.0.0"
Expand Down
42 changes: 42 additions & 0 deletions integration/helpers/vite-5-template/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "integration-vite-5-template",
"version": "0.0.0",
"private": true,
"sideEffects": false,
"type": "module",
"scripts": {
"dev": "remix vite:dev",
"build": "remix vite:build",
"start": "remix-serve ./build/server/index.js",
"typecheck": "tsc"
},
"dependencies": {
"@remix-run/express": "workspace:*",
"@remix-run/node": "workspace:*",
"@remix-run/react": "workspace:*",
"@remix-run/serve": "workspace:*",
"@vanilla-extract/css": "^1.10.0",
"@vanilla-extract/vite-plugin": "^3.9.2",
"express": "^4.20.0",
"isbot": "^4.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"serialize-javascript": "^6.0.1"
},
"devDependencies": {
"@remix-run/dev": "workspace:*",
"@remix-run/eslint-config": "workspace:*",
"@remix-run/route-config": "workspace:*",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"eslint": "^8.38.0",
"typescript": "^5.1.6",
"vite": "5.1.8",
"vite-env-only": "^2.0.0",
"vite-tsconfig-paths": "^4.2.1",
"wrangler": "^3.24.0"
},
"engines": {
"node": ">=18.0.0"
}
}
5 changes: 5 additions & 0 deletions integration/helpers/vite-6-template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules

/.cache
/build
.env
25 changes: 25 additions & 0 deletions integration/helpers/vite-6-template/app/root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react";

export default function App() {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
<Outlet />
<ScrollRestoration />
<Scripts />
</body>
</html>
);
}
41 changes: 41 additions & 0 deletions integration/helpers/vite-6-template/app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import type { MetaFunction } from "@remix-run/node";

export const meta: MetaFunction = () => {
return [
{ title: "New Remix App" },
{ name: "description", content: "Welcome to Remix!" },
];
};

export default function Index() {
return (
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}>
<h1>Welcome to Remix</h1>
<ul>
<li>
<a
target="_blank"
href="https://remix.run/tutorials/blog"
rel="noreferrer"
>
15m Quickstart Blog Tutorial
</a>
</li>
<li>
<a
target="_blank"
href="https://remix.run/tutorials/jokes"
rel="noreferrer"
>
Deep Dive Jokes App Tutorial
</a>
</li>
<li>
<a target="_blank" href="https://remix.run/docs" rel="noreferrer">
Remix Docs
</a>
</li>
</ul>
</div>
);
}
2 changes: 2 additions & 0 deletions integration/helpers/vite-6-template/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="@remix-run/node" />
/// <reference types="vite/client" />
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "integration-vite-template",
"name": "integration-vite-6-template",
"version": "0.0.0",
"private": true,
"sideEffects": false,
Expand Down Expand Up @@ -31,7 +31,7 @@
"@types/react-dom": "^18.2.7",
"eslint": "^8.38.0",
"typescript": "^5.1.6",
"vite": "5.1.8",
"vite": "^6.0.0",
"vite-env-only": "^2.0.0",
"vite-tsconfig-paths": "^4.2.1",
"wrangler": "^3.24.0"
Expand Down
Binary file not shown.
21 changes: 21 additions & 0 deletions integration/helpers/vite-6-template/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"include": ["env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ESNext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2022",
"strict": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"~/*": ["./app/*"]
},
"noEmit": true
}
}
7 changes: 7 additions & 0 deletions integration/helpers/vite-6-template/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

export default defineConfig({
plugins: [remix(), tsconfigPaths()],
});
8 changes: 4 additions & 4 deletions integration/helpers/vite-cloudflare-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"typecheck": "tsc"
},
"dependencies": {
"@remix-run/cloudflare": "2.15.2",
"@remix-run/cloudflare-pages": "2.15.2",
"@remix-run/react": "2.15.2",
"@remix-run/cloudflare": "workspace:*",
"@remix-run/cloudflare-pages": "workspace:*",
"@remix-run/react": "workspace:*",
"isbot": "^4.1.0",
"miniflare": "^3.20231030.4",
"react": "^18.2.0",
Expand All @@ -26,7 +26,7 @@
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"typescript": "^5.1.6",
"vite": "5.1.8",
"vite": "^6.0.0",
"vite-tsconfig-paths": "^4.2.1",
"wrangler": "^3.24.0"
},
Expand Down
24 changes: 19 additions & 5 deletions integration/helpers/vite.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { spawn, spawnSync, type ChildProcess } from "node:child_process";
import path from "node:path";
import path from "pathe";
import fs from "node:fs/promises";
import type { Readable } from "node:stream";
import url from "node:url";
Expand Down Expand Up @@ -96,11 +96,22 @@ export const EXPRESS_SERVER = (args: {
app.listen(port, () => console.log('http://localhost:' + port));
`;

type TemplateName = "vite-template" | "vite-cloudflare-template";
type TemplateName =
| "vite-5-template"
| "vite-6-template"
| "vite-cloudflare-template";

export const viteMajorTemplates = [
{ templateName: "vite-5-template", templateDisplayName: "Vite 5" },
{ templateName: "vite-6-template", templateDisplayName: "Vite 6" },
] as const satisfies ReadonlyArray<{
templateName: TemplateName;
templateDisplayName: string;
}>;

export async function createProject(
files: Record<string, string> = {},
templateName: TemplateName = "vite-template"
templateName: TemplateName = "vite-5-template"
) {
let projectName = `remix-${Math.random().toString(32).slice(2)}`;
let projectDir = path.join(TMP_DIR, projectName);
Expand Down Expand Up @@ -246,7 +257,10 @@ type Fixtures = {
port: number;
cwd: string;
}>;
customDev: (files: Files) => Promise<{
customDev: (
files: Files,
templateName?: TemplateName
) => Promise<{
port: number;
cwd: string;
}>;
Expand Down Expand Up @@ -280,7 +294,7 @@ export const test = base.extend<Fixtures>({
// eslint-disable-next-line no-empty-pattern
customDev: async ({}, use) => {
let stop: (() => unknown) | undefined;
await use(async (files) => {
await use(async (files, template) => {
let port = await getPort();
let cwd = await createProject(await files({ port }));
stop = await customDev({ cwd, port });
Expand Down
3 changes: 2 additions & 1 deletion integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@cloudflare/kv-asset-handler": "^0.3.0",
"@cloudflare/workers-types": "^4.20230518.0",
"@playwright/test": "^1.33.0",
"@playwright/test": "^1.49.1",
"@remix-run/dev": "workspace:*",
"@remix-run/express": "workspace:*",
"@remix-run/node": "workspace:*",
Expand All @@ -30,6 +30,7 @@
"globby": "^11.1.0",
"isbot": "^4.1.0",
"npm-run-all": "^4.1.5",
"pathe": "^1.1.2",
"pidtree": "^0.6.0",
"postcss": "^8.4.19",
"postcss-import": "^15.1.0",
Expand Down
Loading
Loading