Skip to content

Conversation

JSerFeng
Copy link
Contributor

@JSerFeng JSerFeng commented Oct 9, 2025

Summary

should use external import source as the symbol name hint, instead of readable identifier, and do not render unnecessary empty import brackets

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@Copilot Copilot AI review requested due to automatic review settings October 9, 2025 10:04
@JSerFeng JSerFeng enabled auto-merge (squash) October 9, 2025 10:04
Copy link
Contributor

@Copilot Copilot AI left a 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 the naming convention for external imports in ESM output by using the external source as the name hint instead of readable identifiers, and improves import statement rendering to avoid unnecessary empty import brackets.

  • Changes external import symbol naming to use source names (e.g., "fs" → "fs_0") instead of readable identifiers (e.g., "external_fs_")
  • Updates import statement formatting to conditionally render brackets only when there are named imports
  • Adds proper spacing and comma handling for mixed default and named imports

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/rspack_plugin_esm_library/src/link.rs Updates external import name resolution to use source instead of readable_identifier
crates/rspack_plugin_esm_library/src/render.rs Improves import statement formatting with conditional bracket rendering and proper spacing
tests/rspack-test/esmOutputCases/externals/externals-import-render/rspack.config.js Adds test configuration for external module imports
tests/rspack-test/esmOutputCases/externals/externals-import-render/index.js Adds test case for mixed default and named imports
tests/rspack-test/esmOutputCases/externals/externals-import-render/__snapshots__/esm.snap.txt Test snapshot showing clean import formatting without empty brackets
tests/rspack-test/esmOutputCases/re-exports/re-export-external/__snapshots__/esm.snap.txt Updated snapshot reflecting new naming convention and export ordering

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

netlify bot commented Oct 9, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit a0367e0
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/68e788bb63fb960008917f05

@github-actions github-actions bot added team The issue/pr is created by the member of Rspack. release: bug fix release: bug related release(mr only) labels Oct 9, 2025
Copy link
Contributor

github-actions bot commented Oct 9, 2025

📦 Binary Size-limit

Comparing a0367e0 to chore(deps): update swc (#11747) by renovate[bot]

❌ Size increased by 5.38KB from 47.89MB to 47.89MB (⬆️0.01%)

Copy link

codspeed-hq bot commented Oct 9, 2025

CodSpeed Performance Report

Merging #11825 will not alter performance

Comparing esm-lib-plugin (a0367e0) with main (ed1f1fa)

Summary

✅ 17 untouched

@JSerFeng JSerFeng merged commit 73472a8 into main Oct 10, 2025
71 of 73 checks passed
@JSerFeng JSerFeng deleted the esm-lib-plugin branch October 10, 2025 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants