diff --git a/src/index.ts b/src/index.ts index b0220575..c4390377 100644 --- a/src/index.ts +++ b/src/index.ts @@ -253,6 +253,19 @@ const typescript: PluginImpl = (options) => return transformResult; }, + buildEnd(err) + { + if (!err) + return + + // workaround: err.stack contains err.message and Rollup prints both, causing duplication, so split out the stack itself if it exists (c.f. https://github.com/ezolenko/rollup-plugin-typescript2/issues/103#issuecomment-1172820658) + const stackOnly = err.stack?.split(err.message)[1]; + if (stackOnly) + this.error({ ...err, message: err.message, stack: stackOnly }); + else + this.error(err); + }, + generateBundle(bundleOptions) { self._ongenerate();