async init(workerData, onReload) {
		if (this.worker) {
			return;
		}
		log(`initializing ${c.magenta(workerData.name)} router worker`);
		this.worker = new Worker(this.url, {
			execArgv: ["--conditions", "react-server"],
			env: {
				COMPONENT_SERVER_WORKER: "true",
				// DEBUG: "vite:*",
				DEBUG: process.env.DEBUG,
				DEBUG_COLORS: process.env.DEBUG_COLORS,
				NODE_ENV: process.env.NODE_ENV,
				MINIFY: process.argv.includes("--minify") ? "true" : "false",
			},
			workerData,
		});

		await new Promise((resolve, reject) => {
			invariant(this.worker, "Worker is not initialize");
			this.worker.once("message", (event) => {
				if (event === "ready") {
					resolve(undefined);
				} else {
					reject(new Error("rsc worker failed to start"));
				}
			});
		});

		const encoder = new TextEncoder();
		this.worker.on("message", (msg) => {
			const { id, ...event } = JSON.parse(msg);
			if (event.type === "reload") {
				onReload();
				return;
			}

			const res = this.responses.get(id);
			invariant(res, `No response handler for id: ${id}`);
			res(event);
		});

		this.worker.once("exit", (code) => {
			console.log("Component server worker exited with code", code);
			process.exit(code);
		});
	}
@param {any} workerData
@param {() => void} onReload