```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")) {
    if (!line.trim()) continue; // Ignore blank lines
    if (line.startsWith("#")) continue; // Ignore commented lines

    const [key, value] = line.split("=", 2).map(item => item.trim());
    if (!key) throw new Error(`Invalid config file: Empty key on line ${text.indexOf(line) + 1}`);
    
    config[key] = value || ''; // Set empty value as an empty string
  }
  return config;
}
```