-
-
Notifications
You must be signed in to change notification settings - Fork 760
fix: no need to create compiler instance when closing compiler #11923
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
This PR simplifies the Compiler.close() method by using optional chaining to close the compiler instance rather than fetching it through #getInstance(), which prevents unnecessary instance creation and duplicate error logging when the instance doesn't exist.
Key changes:
- Updated
Compiler.close()to usethis.#instance?.close()directly instead of callingthis.#getInstance()followed byinstance!.close() - Added test cases for builtin-swc-loader validation scenarios
Reviewed Changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/rspack/src/Compiler.ts | Simplified close() method to avoid unnecessary instance creation and duplicate error logs |
| tests/rspack-test/configCases/builtin-swc-loader/validate/raw-warning.err | Removed expected error output file |
| tests/rspack-test/configCases/builtin-swc-loader/validate/raw-error.err | Removed expected error output file |
| tests/rspack-test/configCases/builtin-swc-loader/invalid-unknown-option-error/rspack.config.js | Added test configuration for unknown option error handling |
| tests/rspack-test/configCases/builtin-swc-loader/invalid-unknown-option-error/errors.js | Added expected error assertions for unknown option test |
| tests/rspack-test/configCases/builtin-swc-loader/invalid-option-value-error/index.js | Added test case for invalid option value scenarios |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
📦 Binary Size-limit
🙈 Size remains the same at 47.67MB |
CodSpeed Performance ReportMerging #11923 will not alter performanceComparing Summary
Footnotes |
Summary
This PR simplifies the
Compiler.close()method.Use
this.#instance?.close()instead of thethis.#getInstance()method, because if the instance is not created, thethis.#getInstance()method will attempt to create an instance twice and the error logs will be printed twice.Related links
Checklist