-
-
Notifications
You must be signed in to change notification settings - Fork 727
fix(swcLoader): should correctly generate the default value of env_na… #11906
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 ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Could you please add a test case? |
Thanks for your reply, a test case will be provided later. |
3ba840b
to
003f1c1
Compare
@CPunisher rust test cases have been provided. |
CodSpeed Performance ReportMerging #11906 will not alter performanceComparing Summary
|
a8307e9
to
cf1a735
Compare
cf1a735
to
cbe85dc
Compare
@CPunisher Hi, I’ve tried running CI multiple times in my forked repo after syncing my PR branch with the main repo, but I noticed that the test Serial.test.js always fails. I realized that these errors might be caused by another PR rather than mine, so I rolled back the base of my PR branch to 0f38cf19, and the CI finally passed in my forked repo. |
😂 Sorry, recently our ci is not stable. |
📝 Benchmark detail: Open
Threshold exceeded: ["10000_development-mode + exec","10000_development-mode_noop-loader + exec","large-dyn-imports_development-mode + exec","threejs_development-mode_10x + exec"] |
@CPunisher Adding So in the end, I decided to copy this part of the code directly from the SWC repo 😂(https://github.com/swc-project/swc/blob/4848301edca71ed84d147e90baccae217b0a8938/bindings/binding_core_node/src/bundle.rs#L208), hoping to offer a more complete solution rather than just fixing the |
Yes, I have realized your consideration. I will merge this pr after we stablize CI. Thanks for your contribution! |
…me in swc options (#11903)
Summary
In the previous implementation, the remaining fields of the
Options
struct (swc_core::base::config::Options
) were initialized using..Default::default()
. However, this approach can result in some fields having default values that do not match the expected behavior. The root cause is that the fields in Options are defined with serde macros, and custom logic is used to generate default values during deserialization.When initializing
Options
with..Default::default()
, this custom logic is bypassed, leading to discrepancies between the generated fields and the original behavior inswc-loader
. This inconsistency may cause certain swc plugins (such as@swc/plugin-emotion
) to behave unexpectedly.To address this issue and ensure consistency with the original swc implementation, the initialization of the remaining fields in Options has been changed to use deserialization from an empty JSON object via
serde_json
(which is the approach used in the swc source code). This ensures that the configuration is generated in a manner consistent with the original swc behavior.Related links
#11903
Checklist