-
-
Notifications
You must be signed in to change notification settings - Fork 757
fix: should export rspack function from compiler.rspack
#12636
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
Summary of ChangesHello @LingyuCoder, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This PR addresses a critical issue concerning the isolation of Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
✅ 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.
Code Review
This pull request aims to fix an issue with compiler.rspack in multi-compiler setups by ensuring each compiler gets its own RuntimeGlobals. The approach taken correctly identifies that compiler.rspack needs to be a function, but the implementation inadvertently modifies a shared singleton, which would cause issues in the very multi-compiler scenario it's trying to fix. I've provided a critical comment with a suggested fix to create a new function for each compiler instance, ensuring proper isolation. A new test case has also been added which is great for verifying the intended behavior.
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 fixes an issue where RuntimeGlobals should be unique for each compiler instance rather than shared across all exports from @rspack/core. The fix ensures that compiler.rspack and compiler.webpack have compiler-specific RuntimeGlobals instances.
Key changes:
- Added a test to verify
compiler.rspackexports the rspack function with unique RuntimeGlobals - Modified Compiler.ts to create compiler-specific rspack exports with per-compiler RuntimeGlobals
- Changed imports to separate the rspack function from the exports module
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/rspack-test/compilerCases/exports.js | Adds test verifying compiler.rspack is a function with unique RuntimeGlobals instance |
| packages/rspack/src/Compiler.ts | Creates compiler-specific rspack exports object with per-compiler RuntimeGlobals and self-references |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
🙈 Size remains the same at 47.87MB |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
CodSpeed Performance ReportMerging #12636 will not alter performanceComparing Summary
Footnotes
|
Summary
fix #12612
The RuntimeGlobals should be different between
compiler.rspackand the exports of@rspack/core. So we need to create a new exports object for each compiler and should not just assign the new RuntimeGlobals to exports to prevent overriding it.Related links
Checklist