Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
pcattori committed Feb 21, 2024
1 parent a7d62c4 commit 9b395f9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/remix-dev/vite/get-server-build.ts
@@ -1,15 +1,17 @@
import type { ViteDevServer } from "vite";
import type { ServerBuild } from "@remix-run/server-runtime";

const devServerBuild = "virtual:remix/server-build";

export async function getServerBuild(
path: string,
viteDevServer?: ViteDevServer
): Promise<ServerBuild> {
): Promise<ServerBuild | (() => Promise<ServerBuild>)> {
if (viteDevServer) {
return viteDevServer.ssrLoadModule(devServerBuild) as Promise<ServerBuild>;
return () =>
viteDevServer.ssrLoadModule(
"virtual:remix/server-build"
) as Promise<ServerBuild>;
}

try {
return import(path);
} catch (error) {
Expand Down

0 comments on commit 9b395f9

Please sign in to comment.