Skip to content

Conversation

@chenjiahan
Copy link
Contributor

Description

Add error handling for the plugin's transform in the Rspack loader.

Wrapping the plugin.transform.call() in a try-catch block to ensure that any errors thrown during the transformation process are properly captured and passed to Rspack's error handling mechanism.

I made the same changes to the webpack loader to keep it consistent.

Related issues

resolve web-infra-dev/rsbuild#4789

Preview

  • dev without try...catch (process exit):

image

  • dev with try...catch (the error is emit by Rspack and this did not break the dev build):

image

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 21, 2025

Open in Stackblitz

npm i https://pkg.pr.new/unjs/unplugin@482

commit: 7e2bf22

Copy link
Member

@sxzz sxzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sxzz sxzz merged commit 8e08ebe into unjs:main Mar 21, 2025
12 checks passed
@chenjiahan
Copy link
Contributor Author

Thanks for the quick response ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Dev server crashes when editing files

2 participants