```ts
function parseConfig(text: string): Record<string, string> {
  const config: Record<string, string> = {};
  for (const line of text.split("\n")) {
    if (!line.trim() || line.startsWith("#")) continue;
    const [key, value] = line.replace(/\s+/g, "").split("=");
    if (!key) throw new Error(`Line ${line} has no '='`);
    config[key] = value;
  }
  return Object.freeze(config);
}
```