```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 the line on the first '=' only
    const [keyRaw, value] = line.split("=", 2);
    if (!keyRaw) throw new Error(`Empty key on line: ${line}`);

    // Trim whitespace around key and value
    const key = keyRaw.trim();
    config[key] = value.trim();
  }
  return config;
}
```