Revert "[examples] Update Remix template to use Vite (#11217)" (#11227)

This reverts commit 1a45731c92. This
should not have been merged yet. There is still an issue with framework
detection selecting Vite instead of Remix preset.
This commit is contained in:
Nathan Rajlich
2024-03-05 14:45:00 -08:00
committed by GitHub
parent 1a45731c92
commit 5064dd404d
8 changed files with 37 additions and 37 deletions

View File

@@ -1,2 +0,0 @@
---
---

View File

@@ -1,5 +1,7 @@
node_modules node_modules
/.cache
/build /build
/public/build
.env .env
.vercel .vercel

View File

@@ -1,13 +1,20 @@
import { cssBundleHref } from "@remix-run/css-bundle";
import { import {
Links, Links,
LiveReload,
Meta, Meta,
Outlet, Outlet,
Scripts, Scripts,
ScrollRestoration, ScrollRestoration,
} from "@remix-run/react"; } from "@remix-run/react";
import { Analytics } from "@vercel/analytics/react"; import { Analytics } from "@vercel/analytics/react";
import type { LinksFunction } from "@vercel/remix";
export function Layout({ children }: { children: React.ReactNode }) { export const links: LinksFunction = () => [
...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []),
];
export default function App() {
return ( return (
<html lang="en"> <html lang="en">
<head> <head>
@@ -17,15 +24,12 @@ export function Layout({ children }: { children: React.ReactNode }) {
<Links /> <Links />
</head> </head>
<body> <body>
{children} <Outlet />
<ScrollRestoration /> <ScrollRestoration />
<Scripts /> <Scripts />
<LiveReload />
<Analytics /> <Analytics />
</body> </body>
</html> </html>
); );
} }
export default function App() {
return <Outlet />;
}

View File

@@ -4,29 +4,29 @@
"sideEffects": false, "sideEffects": false,
"type": "module", "type": "module",
"scripts": { "scripts": {
"build": "remix vite:build", "build": "remix build",
"dev": "remix vite:dev", "dev": "remix dev --manual",
"start": "remix-serve ./build/index.js",
"typecheck": "tsc" "typecheck": "tsc"
}, },
"dependencies": { "dependencies": {
"@remix-run/node": "^2.8.0", "@remix-run/css-bundle": "^2.0.0",
"@remix-run/react": "^2.8.0", "@remix-run/node": "^2.0.0",
"@remix-run/server-runtime": "^2.8.0", "@remix-run/react": "^2.0.0",
"@vercel/analytics": "^1.2.2", "@remix-run/serve": "^2.0.0",
"@vercel/remix": "^2.8.0", "@vercel/analytics": "^1.0.2",
"isbot": "^4", "@vercel/remix": "^2.0.0",
"isbot": "^3.6.8",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0" "react-dom": "^18.2.0"
}, },
"devDependencies": { "devDependencies": {
"@remix-run/dev": "^2.8.0", "@remix-run/dev": "^2.0.0",
"@remix-run/eslint-config": "^2.8.0", "@remix-run/eslint-config": "^2.0.0",
"@types/react": "^18.2.20", "@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7", "@types/react-dom": "^18.2.7",
"eslint": "^8.38.0", "eslint": "^8.38.0",
"typescript": "^5.1.6", "typescript": "^5.1.6"
"vite": "^5.1.0",
"vite-tsconfig-paths": "^4.2.1"
}, },
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=18.0.0"

View File

@@ -0,0 +1,8 @@
/** @type {import('@remix-run/dev').AppConfig} */
export default {
ignoredRouteFiles: ["**/.*"],
// appDirectory: "app",
// assetsBuildDirectory: "public/build",
// publicPath: "/build/",
// serverBuildPath: "build/index.js",
};

2
examples/remix/remix.env.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
/// <reference types="@remix-run/dev" />
/// <reference types="@vercel/remix" />

View File

@@ -1,25 +1,22 @@
{ {
"include": ["**/*.ts", "**/*.tsx"], "include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": { "compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2022"], "lib": ["DOM", "DOM.Iterable", "ES2022"],
"types": ["@vercel/remix", "node", "vite/client"],
"isolatedModules": true, "isolatedModules": true,
"esModuleInterop": true, "esModuleInterop": true,
"jsx": "react-jsx", "jsx": "react-jsx",
"module": "ESNext",
"moduleResolution": "Bundler", "moduleResolution": "Bundler",
"resolveJsonModule": true, "resolveJsonModule": true,
"target": "ES2022", "target": "ES2022",
"strict": true, "strict": true,
"allowJs": true, "allowJs": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"~/*": ["./app/*"] "~/*": ["./app/*"]
}, },
// Vite takes care of building everything, not tsc. // Remix takes care of building everything in `remix build`.
"noEmit": true "noEmit": true
} }
} }

View File

@@ -1,11 +0,0 @@
import { vitePlugin as remix } from "@remix-run/dev";
import { installGlobals } from "@remix-run/node";
import { defineConfig } from "vite";
import { vercelPreset } from '@vercel/remix/vite';
import tsconfigPaths from "vite-tsconfig-paths";
installGlobals();
export default defineConfig({
plugins: [remix({ presets: [vercelPreset()] }), tsconfigPaths()],
});