From 03248a8338ea0dade49a74cceae27f8eba227ab8 Mon Sep 17 00:00:00 2001 From: Orfeas Zafeiris Date: Mon, 26 Jan 2026 18:09:44 +0200 Subject: [PATCH 1/2] Check for compilation errors in OutputPlugin Previously, the RepackOutputPlugin would always assume compilation had succeeded. The `done` hook gets fired even after compilation finishes with errors, which would cause the plugin to try to copy around chunks that haven't been written to disk (due to said errors), resulting in cryptic errors about `index.bundle` not being found. This change adds a check for compilation errors, and aborts the bundling process if it finds any. --- packages/repack/src/plugins/OutputPlugin/OutputPlugin.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/repack/src/plugins/OutputPlugin/OutputPlugin.ts b/packages/repack/src/plugins/OutputPlugin/OutputPlugin.ts index 69a551c9e..3825204f0 100644 --- a/packages/repack/src/plugins/OutputPlugin/OutputPlugin.ts +++ b/packages/repack/src/plugins/OutputPlugin/OutputPlugin.ts @@ -184,6 +184,10 @@ export class OutputPlugin { ); compiler.hooks.done.tapPromise('RepackOutputPlugin', async (stats) => { + if (stats.hasErrors()) { + throw new Error('[RepackOutputPlugin] Compilation failed:\n' + stats.toString('errors-only')); + } + const compilationStats = stats.toJson({ all: false, assets: true, From 7209541e8270b875e900d8b748379db66d278740 Mon Sep 17 00:00:00 2001 From: OrfeasZ Date: Mon, 26 Jan 2026 18:18:58 +0200 Subject: [PATCH 2/2] Add changeset --- .changeset/frank-cougars-go.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/frank-cougars-go.md diff --git a/.changeset/frank-cougars-go.md b/.changeset/frank-cougars-go.md new file mode 100644 index 000000000..f4d2244c3 --- /dev/null +++ b/.changeset/frank-cougars-go.md @@ -0,0 +1,5 @@ +--- +"@callstack/repack": patch +--- + +Handle previous compiler errors and abort bundling in `RepackOutputPlugin`