-
-
Notifications
You must be signed in to change notification settings - Fork 724
fix(swc_plugin_import): fix panic and optimize diagnostic logs #11862
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
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Fixes panic in swc_plugin_import when invalid template options are provided and improves diagnostic error messages. The changes convert panics to proper error handling with clearer error messages that include context about which configuration option failed.
- Add proper error handling for template parsing instead of using unwrap()
- Update error messages to be more descriptive and user-friendly
- Add test cases for invalid template configurations
Reviewed Changes
Copilot reviewed 16 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
crates/swc_plugin_import/src/template.rs | Updates error types and messages for better diagnostics |
crates/swc_plugin_import/src/lib.rs | Replaces unwrap() calls with proper error handling and improved error messages |
tests/rspack-test/configCases/builtin-swc-loader/plugin-import-invalid-template/* | Test case for empty template strings |
tests/rspack-test/configCases/builtin-swc-loader/plugin-import-invalid-helper/* | Test case for invalid helper configurations |
tests/rspack-test/configCases/builtin-swc-loader/plugin-import-imcomplate-template/* | Test case for incomplete template strings |
tests/rspack-test/configCases/builtin-swc-loader/issue-5329/* | Removes outdated test files |
Comments suppressed due to low confidence (2)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...spack-test/configCases/builtin-swc-loader/plugin-import-incomplate-template/rspack.config.js
Show resolved
Hide resolved
📦 Binary Size-limit
🎉 Size decreased by 282.00KB from 47.89MB to 47.62MB (⬇️0.58%) |
CodSpeed Performance ReportMerging #11862 will not alter performanceComparing Summary
|
Summary
.unwrap()
calls.Before
customName: "{{ unknown member }}"
customName: "{{ member"
After
customName: "{{ unknown member }}"
customName: "{{ member"
customName: "{{ }}"
Checklist