-
-
Notifications
You must be signed in to change notification settings - Fork 757
fix: inlined export invalid syntax comment #12681
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 fixes a bug where inlined export comments were placed outside parentheses, creating invalid JavaScript syntax in certain contexts (especially division operations). The fix moves comments inside the parentheses.
Key changes:
- Modified
EvaluatedInlinableValue::render()andInlinedUsedName::render()to accept acommentparameter and place it inside parentheses:(/* comment */value)instead of/* comment */ (value) - Updated all call sites across the codebase to pass the appropriate comment string
- Added a new test case to verify the fix works correctly for division expressions
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
crates/rspack_core/src/exports/utils.rs |
Core fix: Modified render methods to accept comment parameter and place it inside parentheses |
crates/rspack_core/src/concatenated_module.rs |
Updated all inlined value render calls to use new API with comment parameter |
crates/rspack_core/src/runtime_template.rs |
Updated inlined value render call to use new API |
crates/rspack_core/src/exports/export_info_getter.rs |
Updated render call with empty comment for rename info |
crates/rspack_plugin_esm_library/src/link.rs |
Updated multiple inlined value render calls with appropriate comments |
crates/rspack_plugin_javascript/src/dependency/esm/esm_export_imported_specifier_dependency.rs |
Updated to generate proper comment for inlined exports |
crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_*.rs |
Updated CommonJS dependency handlers to use new render API |
crates/rspack_plugin_library/src/*.rs |
Updated library plugin render calls with empty comments |
tests/rspack-test/configCases/inline-const/generated-syntax/* |
New test case verifying fix for division expression syntax |
tests/rspack-test/configCases/rsdoctor/assets/rspack.config.js |
Updated expected file sizes (1 byte reduction per file) |
| All other test snapshot files | Updated snapshots to reflect new comment placement inside parentheses |
💡 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 decreased by 768bytes from 47.87MB to 47.87MB (⬇️0.00%) |
Merging this PR will not alter performanceSummary
Comparing Footnotes
|
Summary
fix #12631
Related links
Checklist