diff --git a/.changeset/sour-houses-fly.md b/.changeset/sour-houses-fly.md new file mode 100644 index 00000000000..517e81e69f6 --- /dev/null +++ b/.changeset/sour-houses-fly.md @@ -0,0 +1,5 @@ +--- +"@remix-run/dev": patch +--- + +Clean up redundant client route query strings on route JavaScript files in production builds diff --git a/packages/remix-dev/vite/plugin.ts b/packages/remix-dev/vite/plugin.ts index 7dcce6a9f6d..43045c74259 100644 --- a/packages/remix-dev/vite/plugin.ts +++ b/packages/remix-dev/vite/plugin.ts @@ -347,7 +347,7 @@ const resolveChunk = ( return entryChunk; }; -const resolveBuildAssetPaths = ( +const getRemixManifestBuildAssets = ( ctx: RemixPluginContext, viteManifest: Vite.Manifest, entryFilePath: string, @@ -366,7 +366,7 @@ const resolveBuildAssetPaths = ( ]); return { - module: `${ctx.remixConfig.publicPath}${entryChunk.file}${CLIENT_ROUTE_QUERY_STRING}`, + module: `${ctx.remixConfig.publicPath}${entryChunk.file}`, imports: dedupe(chunks.flatMap((e) => e.imports ?? [])).map((imported) => { return `${ctx.remixConfig.publicPath}${viteManifest[imported].file}`; @@ -856,7 +856,7 @@ export const remixVitePlugin: RemixVitePlugin = (remixUserConfig = {}) => { getClientBuildDirectory(ctx.remixConfig) ); - let entry = resolveBuildAssetPaths( + let entry = getRemixManifestBuildAssets( ctx, viteManifest, ctx.entryClientFilePath @@ -886,7 +886,7 @@ export const remixVitePlugin: RemixVitePlugin = (remixUserConfig = {}) => { hasClientAction: sourceExports.includes("clientAction"), hasClientLoader: sourceExports.includes("clientLoader"), hasErrorBoundary: sourceExports.includes("ErrorBoundary"), - ...resolveBuildAssetPaths( + ...getRemixManifestBuildAssets( ctx, viteManifest, routeFilePath,