Skip to content

Commit 2d34a7e

Browse files
Remove unused default server entries (#11615)
1 parent 09b52e4 commit 2d34a7e

File tree

4 files changed

+7
-186
lines changed

4 files changed

+7
-186
lines changed

packages/remix-dev/cli/commands.ts

+3-26
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ let conjunctionListFormat = new Intl.ListFormat("en", {
7575
type: "conjunction",
7676
});
7777

78-
let disjunctionListFormat = new Intl.ListFormat("en", {
79-
style: "long",
80-
type: "disjunction",
81-
});
82-
8378
export async function generateEntry(
8479
entry: string,
8580
reactRouterRoot: string,
@@ -116,26 +111,8 @@ export async function generateEntry(
116111
let pkgJson = await PackageJson.load(rootDirectory);
117112
let deps = pkgJson.content.dependencies ?? {};
118113

119-
let serverRuntime = deps["@react-router/deno"]
120-
? "deno"
121-
: deps["@react-router/cloudflare"]
122-
? "cloudflare"
123-
: deps["@react-router/node"]
124-
? "node"
125-
: undefined;
126-
127-
if (!serverRuntime) {
128-
let serverRuntimes = [
129-
"@react-router/deno",
130-
"@react-router/cloudflare",
131-
"@react-router/node",
132-
];
133-
let formattedList = disjunctionListFormat.format(serverRuntimes);
134-
console.error(
135-
colors.error(
136-
`Could not determine server runtime. Please install one of the following: ${formattedList}`
137-
)
138-
);
114+
if (!deps["@react-router/node"]) {
115+
console.error(colors.error(`No default server entry detected.`));
139116
return;
140117
}
141118

@@ -146,7 +123,7 @@ export async function generateEntry(
146123
defaultsDirectory,
147124
ctx?.reactRouterConfig.ssr === false
148125
? `entry.server.spa.tsx`
149-
: `entry.server.${serverRuntime}.tsx`
126+
: `entry.server.node.tsx`
150127
);
151128

152129
let isServerEntry = entry === "entry.server";

packages/remix-dev/config.ts

+4-50
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ export async function resolveEntryFiles({
474474
rootDirectory: string;
475475
reactRouterConfig: ResolvedVitePluginConfig;
476476
}) {
477-
let { appDirectory, future } = reactRouterConfig;
477+
let { appDirectory } = reactRouterConfig;
478478

479479
let defaultsDirectory = path.resolve(__dirname, "config", "defaults");
480480

@@ -500,23 +500,9 @@ export async function resolveEntryFiles({
500500
} else if (userEntryServerFile) {
501501
entryServerFile = userEntryServerFile;
502502
} else {
503-
let serverRuntime = deps["@react-router/deno"]
504-
? "deno"
505-
: deps["@react-router/cloudflare"]
506-
? "cloudflare"
507-
: deps["@react-router/node"]
508-
? "node"
509-
: undefined;
510-
511-
if (!serverRuntime) {
512-
let serverRuntimes = [
513-
"@react-router/deno",
514-
"@react-router/cloudflare",
515-
"@react-router/node",
516-
];
517-
let formattedList = disjunctionListFormat.format(serverRuntimes);
503+
if (!deps["@react-router/node"]) {
518504
throw new Error(
519-
`Could not determine server runtime. Please install one of the following: ${formattedList}`
505+
`Could not determine server runtime. Please install @react-router/node, or provide a custom entry.server.tsx/jsx file in your app directory.`
520506
);
521507
}
522508

@@ -542,7 +528,7 @@ export async function resolveEntryFiles({
542528
});
543529
}
544530

545-
entryServerFile = `entry.server.${serverRuntime}.tsx`;
531+
entryServerFile = `entry.server.node.tsx`;
546532
}
547533

548534
let entryClientFilePath = userEntryClientFile
@@ -566,35 +552,3 @@ function findEntry(dir: string, basename: string): string | undefined {
566552

567553
return undefined;
568554
}
569-
570-
// adds types for `Intl.ListFormat` to the global namespace
571-
// we could also update our `tsconfig.json` to include `lib: ["es2021"]`
572-
declare namespace Intl {
573-
type ListType = "conjunction" | "disjunction";
574-
575-
interface ListFormatOptions {
576-
localeMatcher?: "lookup" | "best fit";
577-
type?: ListType;
578-
style?: "long" | "short" | "narrow";
579-
}
580-
581-
interface ListFormatPart {
582-
type: "element" | "literal";
583-
value: string;
584-
}
585-
586-
class ListFormat {
587-
constructor(locales?: string | string[], options?: ListFormatOptions);
588-
format(values: any[]): string;
589-
formatToParts(values: any[]): ListFormatPart[];
590-
supportedLocalesOf(
591-
locales: string | string[],
592-
options?: ListFormatOptions
593-
): string[];
594-
}
595-
}
596-
597-
let disjunctionListFormat = new Intl.ListFormat("en", {
598-
style: "long",
599-
type: "disjunction",
600-
});

packages/remix-dev/config/defaults/entry.server.cloudflare.tsx

-55
This file was deleted.

packages/remix-dev/config/defaults/entry.server.deno.tsx

-55
This file was deleted.

0 commit comments

Comments
 (0)