Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(diagnostics): workaround Rollup duplicating error messages #373

Merged
merged 2 commits into from Jul 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/index.ts
Expand Up @@ -253,6 +253,19 @@ const typescript: PluginImpl<RPT2Options> = (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();
Expand Down