```ts
/** The KEY=VALUE pairs of a config file. */
export function parseConfig(text: string): Record<string, string> {
  const config: Record<string, string> = {};
  for (const line of text.split("\n")) {
    // Ignore blank lines and comments
    if (line.trim() === "" || line.startsWith("#")) continue;

    // Split on the first '=' to allow values with '=' in them
    const eqIndex = line.indexOf("=");
    if (eqIndex === -1) throw new Error(`Invalid config line: ${line}`);

    // Trim whitespace around key and value
    const key = line.slice(0, eqIndex).trim();
    const value = line.slice(eqIndex + 1).trim();

    // Ensure the key is not "__proto__" to avoid prototype pollution
    if (key === "__proto__") continue;

    // Throw an error if the key is empty
    if (key === "") throw new Error(`Empty key in config line: ${line}`);

    // Store the key-value pair in the configuration object
    config[key] = value;
  }
  return config;
}
```