diff --git a/packages/remix-dev/vite/plugin.ts b/packages/remix-dev/vite/plugin.ts index 2a9ec14c7a..72ee1285d5 100644 --- a/packages/remix-dev/vite/plugin.ts +++ b/packages/remix-dev/vite/plugin.ts @@ -821,6 +821,11 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = (_config) => { return JSON.parse(manifestContents) as Vite.Manifest; }; + let getViteManifestFilePaths = (viteManifest: Vite.Manifest): Set => { + let filePaths = Object.values(viteManifest).map((chunk) => chunk.file); + return new Set(filePaths); + }; + let getViteManifestAssetPaths = ( viteManifest: Vite.Manifest ): Set => { @@ -1405,7 +1410,7 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = (_config) => { let ssrViteManifest = await loadViteManifest(serverBuildDirectory); let clientViteManifest = await loadViteManifest(clientBuildDirectory); - let clientAssetPaths = getViteManifestAssetPaths(clientViteManifest); + let clientFilePaths = getViteManifestFilePaths(clientViteManifest); let ssrAssetPaths = getViteManifestAssetPaths(ssrViteManifest); // We only move assets that aren't in the client build, otherwise we @@ -1417,7 +1422,7 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = (_config) => { let movedAssetPaths: string[] = []; for (let ssrAssetPath of ssrAssetPaths) { let src = path.join(serverBuildDirectory, ssrAssetPath); - if (!clientAssetPaths.has(ssrAssetPath)) { + if (!clientFilePaths.has(ssrAssetPath)) { let dest = path.join(clientBuildDirectory, ssrAssetPath); await fse.move(src, dest); movedAssetPaths.push(dest);