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` 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,