Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: add error handling to transform for Rspack and webpack #482

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

Merged
merged 2 commits into from
Mar 21, 2025

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

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