Repository: withastro/astro
File: packages/astro/src/core/server-islands/vite-plugin-server-islands.ts (TypeScript)

Code before:
		},
		configureServer(_server) {
			viteServer = _server;
		},
		resolveId(name) {
			if (name === VIRTUAL_ISLAND_MAP_ID) {
				return RESOLVED_VIRTUAL_ISLAND_MAP_ID;
			}
		},
		load(id) {
			if (id === RESOLVED_VIRTUAL_ISLAND_MAP_ID) {
				return `export const serverIslandMap = ${serverIslandPlaceholder};`;
			}
		},
		transform(_code, id) {
			if (id.endsWith('.astro')) {
				const info = this.getModuleInfo(id);
				if (info?.meta) {
					const astro = info.meta.astro as AstroPluginMetadata['astro'] | undefined;
					if (astro?.serverComponents.length) {
						for (const comp of astro.serverComponents) {
							if (!settings.serverIslandNameMap.has(comp.resolvedPath)) {
								if (!settings.adapter) {
									logger.error(
										'islands',
										"You tried to render a server island without an adapter added to your project. An adapter is required to use the `server: defer` attribute on any component. Your project will fail to build unless you add an adapter or remove the attribute.",
									);
								}

								let name = comp.localName;
								let idx = 1;

								while (true) {
									// Name not taken, let's use it.
									if (!settings.serverIslandMap.has(name)) {
										break;
									}
									// Increment a number onto the name: Avatar -> Avatar1
									name += idx++;
								}

								// Append the name map, for prod
								settings.serverIslandNameMap.set(comp.resolvedPath, name);

								settings.serverIslandMap.set(name, () => {
									return viteServer?.ssrLoadModule(comp.resolvedPath) as any;
								});

								// Build mode
								if (command === 'build') {
									let referenceId = this.emitFile({

Review comment (bug):
```suggestion
										"You tried to render a server island without an adapter added to your project. An adapter is required to use the `server:defer` attribute on any component. Your project will fail to build unless you add an adapter or remove the attribute.",
```

Code after:
		},
		configureServer(_server) {
			viteServer = _server;
		},
		resolveId(name) {
			if (name === VIRTUAL_ISLAND_MAP_ID) {
				return RESOLVED_VIRTUAL_ISLAND_MAP_ID;
			}
		},
		load(id) {
			if (id === RESOLVED_VIRTUAL_ISLAND_MAP_ID) {
				return `export const serverIslandMap = ${serverIslandPlaceholder};`;
			}
		},
		transform(_code, id) {
			if (id.endsWith('.astro')) {
				const info = this.getModuleInfo(id);
				if (info?.meta) {
					const astro = info.meta.astro as AstroPluginMetadata['astro'] | undefined;
					if (astro?.serverComponents.length) {
						for (const comp of astro.serverComponents) {
							if (!settings.serverIslandNameMap.has(comp.resolvedPath)) {
								if (!settings.adapter) {
									logger.error(
										'islands',
										"You tried to render a server island without an adapter added to your project. An adapter is required to use the `server:defer` attribute on any component. Your project will fail to build unless you add an adapter or remove the attribute.",
									);
								}

								let name = comp.localName;
								let idx = 1;

								while (true) {
									// Name not taken, let's use it.
									if (!settings.serverIslandMap.has(name)) {
										break;
									}
									// Increment a number onto the name: Avatar -> Avatar1
									name += idx++;
								}

								// Append the name map, for prod
								settings.serverIslandNameMap.set(comp.resolvedPath, name);

								settings.serverIslandMap.set(name, () => {
									return viteServer?.ssrLoadModule(comp.resolvedPath) as any;
								});

								// Build mode
								if (command === 'build') {
									let referenceId = this.emitFile({