From ac44d527407766f599ee2b6dc43f502e3edb500a Mon Sep 17 00:00:00 2001 From: Shannon Anahata Date: Mon, 10 Nov 2025 14:41:51 -0800 Subject: [PATCH] fix: PNG images being embedded as binary in local dev In local development, esbuild's write option was set to false, causing PNG images to be embedded as binary data in the JavaScript output instead of being written as external files. This resulted in 'Invalid or unexpected token' errors when rendering pages with images. Now setting write=true for both development and CI environments, while keeping it false for production Lambda runtime where the filesystem is read-only. Fixes issues multiple developers were experiencing in local dev. --- src/mdx.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mdx.ts b/src/mdx.ts index 020af221b086a..b47fe4a743beb 100644 --- a/src/mdx.ts +++ b/src/mdx.ts @@ -685,7 +685,8 @@ export async function getFileBySlug(slug: string): Promise { // Set write to false to prevent esbuild from writing files automatically. // We'll handle writing manually to gracefully handle read-only filesystems (e.g., Lambda runtime) - options.write = !!process.env.CI; + // In local dev, we need write=true to avoid images being embedded as binary data + options.write = process.env.NODE_ENV === 'development' || !!process.env.CI; return options; },