Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish committed Jan 11, 2024
1 parent b69a9f0 commit 61939b3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/remix-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ const getRouteModuleExports = async (
viteChildCompiler: Vite.ViteDevServer | null,
pluginConfig: ResolvedRemixVitePluginConfig,
routeFile: string,
readRouteFile: () => string | Promise<string> = () =>
fse.readFile(routeFile, "utf-8")
readRouteFile?: () => string | Promise<string>
): Promise<string[]> => {
if (!viteChildCompiler) {
throw new Error("Vite child compiler not found");
Expand All @@ -320,7 +319,7 @@ const getRouteModuleExports = async (

let [id, code] = await Promise.all([
resolveId(),
readRouteFile(),
readRouteFile?.() ?? fse.readFile(routePath, "utf-8"),
// pluginContainer.transform(...) fails if we don't do this first:
moduleGraph.ensureEntryFromUrl(url, ssr),
]);
Expand Down

0 comments on commit 61939b3

Please sign in to comment.