Repository: remix-run/react-router
File: packages/react-router-dev/vite/plugin.ts (TypeScript)

Code before:
            : ssrExternals,
        conditions,
        externalConditions: conditions,
      },
      build: {
        // We move SSR-only assets to client assets. Note that the
        // SSR build can also emit code-split JS files (e.g. by
        // dynamic import) under the same assets directory
        // regardless of "ssrEmitAssets" option, so we also need to
        // keep these JS files have to be kept as-is.
        ssrEmitAssets: true,
        copyPublicDir: false, // Assets in the public directory are only used by the client
        rollupOptions: {
          input:
            (ctx.reactRouterConfig.future.unstable_viteEnvironmentApi
              ? viteUserConfig.environments?.ssr?.build?.rollupOptions?.input
              : viteUserConfig.build?.rollupOptions?.input) ??
            virtual.serverBuild.id,
          output: {
            entryFileNames: serverBuildFile,
            format: serverModuleFormat,
          },
        },
      },
    });
  }

  let environmentOptionsResolvers: EnvironmentOptionsResolvers = {
    client: ({ viteUserConfig }) =>
      mergeEnvironmentOptions(getBaseOptions({ viteUserConfig }), {
        build: {
          rollupOptions: {
            input: [
              ctx.entryClientFilePath,
              ...Object.values(ctx.reactRouterConfig.routes).flatMap(
                (route) => {
                  let routeFilePath = path.resolve(
                    ctx.reactRouterConfig.appDirectory,
                    route.file
                  );

                  let isRootRoute =
                    route.file === ctx.reactRouterConfig.routes.root.file;

                  let code = fse.readFileSync(routeFilePath, "utf-8");

                  return [
                    `${routeFilePath}${BUILD_CLIENT_ROUTE_QUERY_STRING}`,
                    ...(ctx.reactRouterConfig.future
                      .unstable_splitRouteModules && !isRootRoute
                      ? routeChunkExportNames.map((exportName) =>

Review comment (suggestion):
Since the `route-ids` query string is no longer used, this config is now common across all SSR builds including server bundles.

Code after:
          // provided by vite-plugin-cloudflare within this repo. When compiling
          // for Cloudflare, all server dependencies are externalized, but our
          // `ssrExternals` config inadvertently overrides this. This doesn't
          // impact consumers because for them `ssrExternals` is undefined and
          // Cloudflare's "noExternal: true" config remains intact.
          ctx.reactRouterConfig.future.unstable_viteEnvironmentApi &&
          viteUserConfig.environments?.ssr?.resolve?.noExternal === true
            ? undefined
            : ssrExternals,
        conditions,
        externalConditions: conditions,
      },
      build: {
        // We move SSR-only assets to client assets. Note that the
        // SSR build can also emit code-split JS files (e.g. by
        // dynamic import) under the same assets directory
        // regardless of "ssrEmitAssets" option, so we also need to
        // keep these JS files have to be kept as-is.
        ssrEmitAssets: true,
        copyPublicDir: false, // Assets in the public directory are only used by the client
        rollupOptions: {
          input:
            (ctx.reactRouterConfig.future.unstable_viteEnvironmentApi
              ? viteUserConfig.environments?.ssr?.build?.rollupOptions?.input
              : viteUserConfig.build?.rollupOptions?.input) ??
            virtual.serverBuild.id,
          output: {
            entryFileNames: serverBuildFile,
            format: serverModuleFormat,
          },
        },
      },
    });
  }

  let environmentOptionsResolvers: EnvironmentOptionsResolvers = {
    client: ({ viteUserConfig }) =>
      mergeEnvironmentOptions(getBaseOptions({ viteUserConfig }), {
        build: {
          rollupOptions: {
            input: [
              ctx.entryClientFilePath,
              ...Object.values(ctx.reactRouterConfig.routes).flatMap(
                (route) => {
                  let routeFilePath = path.resolve(
                    ctx.reactRouterConfig.appDirectory,
                    route.file
                  );

                  let isRootRoute =
                    route.file === ctx.reactRouterConfig.routes.root.file;