From 8112ff1ec31ee0a9ce53beb21e7dd350e9c53d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Wed, 19 Nov 2025 07:52:17 +0100 Subject: [PATCH] fix: add CommonJS compatibility for lamejs dynamic import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed MP3 export error by handling both default and named exports from lamejs module to support CommonJS/ESM interop. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- lib/audio/export.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/audio/export.ts b/lib/audio/export.ts index 55d8787..660f330 100644 --- a/lib/audio/export.ts +++ b/lib/audio/export.ts @@ -136,8 +136,9 @@ export async function audioBufferToMp3( audioBuffer: AudioBuffer, options: ExportOptions = { format: 'mp3', bitrate: 192 } ): Promise { - // Dynamically import lamejs - const lamejs = await import('lamejs'); + // Dynamically import lamejs - use default export for CommonJS compatibility + const lameModule = await import('lamejs'); + const lamejs = lameModule.default || lameModule; const { bitrate = 192, normalize } = options; const numberOfChannels = Math.min(audioBuffer.numberOfChannels, 2); // MP3 supports max 2 channels