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 use a server island without an adapter. This an error and your project won't build.",
									);
								}

								if (settings.buildOutput !== 'server') {
									logger.error(
										'islands',
										'You tried to use a server island, but your output isn\'t `"server"`. Use an adapter that support server output.',
									);
								}

								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);


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.",
```
Here's a suggestion for what this could be!

If they are getting an error message, we probably don't have to *say* this is an error. (We *might* not need to tell people it won't build, either. But I understand maybe wanting to say that if something will work in dev but only fail at build time.)

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({