-
-
Notifications
You must be signed in to change notification settings - Fork 757
feat: support import and export string specifier #12759
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-v2 canceled.
|
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
❌ Size increased by 5.50KB from 47.99MB to 48.00MB (⬆️0.01%) |
Merging this PR will not alter performance
Comparing Footnotes
|
The base branch was changed.
7d0cf92 to
6e4f76e
Compare
✅ 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 adds support for rendering ES module import and export statements with string specifiers, which allows using identifiers that are not valid JavaScript variable names (e.g., import {"a.b" as foo} or export {foo as "b.c"}).
Changes:
- Introduced
export_nameutility function to properly quote export/import specifiers when needed - Updated ESM library rendering to use
export_namefor all import/export specifier generation - Added comprehensive test case demonstrating string specifier support with module splitting
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/rspack_core/src/utils/property_name.rs | Adds export_name function to handle quoting of ES module specifiers |
| crates/rspack_plugin_esm_library/src/render.rs | Updates all import/export statement generation to use export_name for proper string specifier handling |
| tests/rspack-test/esmOutputCases/re-exports/string-specifier/rspack.config.js | Configures test with module rules and chunk splitting |
| tests/rspack-test/esmOutputCases/re-exports/string-specifier/lib.js | Test library exporting with string specifier |
| tests/rspack-test/esmOutputCases/re-exports/string-specifier/index.js | Test entry point importing and re-exporting with string specifiers |
| tests/rspack-test/esmOutputCases/re-exports/string-specifier/snapshots/esm.snap.txt | Expected output snapshot verifying correct rendering of string specifiers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/rspack-test/esmOutputCases/re-exports/string-specifier/rspack.config.js
Show resolved
Hide resolved
feat: support export string specifier
feat: support export string specifier
Summary
support render import and export string specifier
Related links
Checklist