Repository: withastro/astro
File: packages/astro/src/core/build/static-build.ts (TypeScript)

Code before:
							return [prefix, sanitizedName, suffix].join('');
						}
						// Injected routes include "pages/[name].[ext]" already. Clean those up!
						if (name.startsWith('pages/')) {
							const sanitizedName = name.split('.')[0];
							return [prefix, sanitizedName, suffix].join('');
						}
						const encoded = encodeName(name);
						return [prefix, encoded, suffix].join('');
					},
					assetFileNames: `${settings.config.build.assets}/[name].[hash][extname]`,
					...viteConfig.build?.rollupOptions?.output,
					entryFileNames(chunkInfo) {
						if (chunkInfo.facadeModuleId?.startsWith(VIRTUAL_PAGE_RESOLVED_MODULE_ID)) {
							return makeAstroPageEntryPointFileName(
								VIRTUAL_PAGE_RESOLVED_MODULE_ID,
								chunkInfo.facadeModuleId,
								routes,
							);
						} else if (
							chunkInfo.facadeModuleId === RESOLVED_SSR_VIRTUAL_MODULE_ID ||
							// This catches the case when the adapter uses `entryType: 'self'. When doing so,
							// the adapter must set rollupOptions.input.
							chunkInfo.facadeModuleId === settings?.config.vite.build?.rollupOptions?.input ||
							// NOTE: I honestly don't like this check. It's brittle and it's code smell. If CF vite plugin
							// decides to rename their virtual module, the feature stops working.
							chunkInfo.facadeModuleId === '\0' + 'virtual:cloudflare/worker-entry'
						) {
							return opts.settings.config.build.serverEntry;
						} else if (chunkInfo.facadeModuleId === RESOLVED_ASTRO_RENDERERS_MODULE_ID) {
							return 'renderers.mjs';
						} else if (chunkInfo.facadeModuleId === SERIALIZED_MANIFEST_RESOLVED_ID) {
							return 'manifest_[hash].mjs';
						} else if (chunkInfo.facadeModuleId === settings.adapter?.serverEntrypoint) {
							return 'adapter_[hash].mjs';
						} else {
							return '[name].mjs';
						}
					},
				},
			},
			ssr: true,
			ssrEmitAssets: true,
			// improve build performance
			minify: false,
			modulePreload: { polyfill: false },
			reportCompressedSize: false,
		},
		plugins: [...flatPlugins, ...(viteConfig.plugins || [])],
		envPrefix: viteConfig.envPrefix ?? 'PUBLIC_',
		base: settings.config.base,

Review comment (suggestion):
```suggestion
							// decides to rename their virtual module, `build.serverEntry` will stop working.
```

Code after:
			emptyOutDir: false,
			copyPublicDir: false,
			manifest: false,
			rollupOptions: {
				...viteConfig.build?.rollupOptions,
				// Setting as `exports-only` allows us to safely delete inputs that are only used during prerendering
				preserveEntrySignatures: 'exports-only',
				...(useLegacyDynamic ? { input: 'virtual:astro:legacy-ssr-entry' } : {}),
				output: {
					hoistTransitiveImports: false,
					format: 'esm',
					minifyInternalExports: true,
					// Server chunks can't go in the assets (_astro) folder
					// We need to keep these separate
					chunkFileNames(chunkInfo) {
						const { name } = chunkInfo;
						let prefix = CHUNKS_PATH;
						let suffix = '_[hash].mjs';

						// Sometimes chunks have the `@_@astro` suffix due to SSR logic. Remove it!
						// TODO: refactor our build logic to avoid this
						if (name.includes(ASTRO_PAGE_EXTENSION_POST_PATTERN)) {
							const [sanitizedName] = name.split(ASTRO_PAGE_EXTENSION_POST_PATTERN);
							return [prefix, sanitizedName, suffix].join('');
						}
						// Injected routes include "pages/[name].[ext]" already. Clean those up!
						if (name.startsWith('pages/')) {
							const sanitizedName = name.split('.')[0];
							return [prefix, sanitizedName, suffix].join('');
						}
						const encoded = encodeName(name);
						return [prefix, encoded, suffix].join('');
					},
					assetFileNames: `${settings.config.build.assets}/[name].[hash][extname]`,
					...viteConfig.build?.rollupOptions?.output,
					entryFileNames(chunkInfo) {
						if (chunkInfo.facadeModuleId?.startsWith(VIRTUAL_PAGE_RESOLVED_MODULE_ID)) {
							return makeAstroPageEntryPointFileName(
								VIRTUAL_PAGE_RESOLVED_MODULE_ID,
								chunkInfo.facadeModuleId,
								routes,
							);
						} else if (
							chunkInfo.facadeModuleId === RESOLVED_SSR_VIRTUAL_MODULE_ID ||
							// This catches the case when the adapter uses `entryType: 'self'. When doing so,
							// the adapter must set rollupOptions.input.
							isRollupInput(chunkInfo.name) ||
							isRollupInput(chunkInfo.facadeModuleId)
						) {
							return opts.settings.config.build.serverEntry;
						} else {