From 99b9b9934372374da370bb4006a4290cb57a24e3 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Tue, 7 Apr 2026 06:32:29 -0300 Subject: [PATCH] fix(e2e): copy static assets to standalone server to fix playright hydration timeouts --- scripts/build-next-isolated.mjs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/build-next-isolated.mjs b/scripts/build-next-isolated.mjs index 68d9acb864..7d0a116aaa 100644 --- a/scripts/build-next-isolated.mjs +++ b/scripts/build-next-isolated.mjs @@ -62,6 +62,23 @@ async function main() { } const result = await runNextBuild(); + if (result.code === 0 && (await exists(path.join(projectRoot, ".next", "standalone")))) { + console.log("[build-next-isolated] Copying static assets for standalone server..."); + try { + await fs.cp( + path.join(projectRoot, "public"), + path.join(projectRoot, ".next", "standalone", "public"), + { recursive: true } + ); + await fs.cp( + path.join(projectRoot, ".next", "static"), + path.join(projectRoot, ".next", "standalone", ".next", "static"), + { recursive: true } + ); + } catch (copyErr) { + console.warn("[build-next-isolated] Non-fatal error copying static assets:", copyErr); + } + } process.exitCode = result.code; } catch (error) { console.error("[build-next-isolated] Build failed:", error);