From 01e201fba3417e33e06c3e81c966f257e6020347 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Mon, 27 Nov 2023 20:05:07 +0900 Subject: [PATCH] fix: basename in getStylesForUrl --- packages/remix-dev/vite/plugin.ts | 2 +- packages/remix-dev/vite/styles.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/remix-dev/vite/plugin.ts b/packages/remix-dev/vite/plugin.ts index 287a9d2a233..da9cdb5b6b2 100644 --- a/packages/remix-dev/vite/plugin.ts +++ b/packages/remix-dev/vite/plugin.ts @@ -70,7 +70,7 @@ type RemixConfigJsdocOverrides = { */ serverBuildPath?: SupportedRemixConfig["serverBuildPath"]; /** - * TODO: doc + * TODO: for now sneak this in as remix vite only option */ basename?: string; }; diff --git a/packages/remix-dev/vite/styles.ts b/packages/remix-dev/vite/styles.ts index 667a6ccbbad..d1b52e81487 100644 --- a/packages/remix-dev/vite/styles.ts +++ b/packages/remix-dev/vite/styles.ts @@ -157,7 +157,9 @@ const createRoutes = ( export const getStylesForUrl = async ( vite: ViteDevServer, - config: Pick, + config: Pick & { + basename: string; + }, cssModulesManifest: Record, build: ServerBuild, url: string | undefined @@ -169,7 +171,7 @@ export const getStylesForUrl = async ( let routes = createRoutes(build.routes); let appPath = path.relative(process.cwd(), config.appDirectory); let documentRouteFiles = - matchRoutes(routes, url, config.publicPath)?.map((match) => + matchRoutes(routes, url, config.basename)?.map((match) => path.join(appPath, config.routes[match.route.id].file) ) ?? [];