Skip to content

fix: use real resource when export from external#12136

Merged
Timeless0911 merged 1 commit intomainfrom
fix/esm-external-request
Nov 10, 2025
Merged

fix: use real resource when export from external#12136
Timeless0911 merged 1 commit intomainfrom
fix/esm-external-request

Conversation

@JSerFeng
Copy link
Copy Markdown
Contributor

Summary

Use real resource when we are exporting from an external module instead of raw user request.

Related links

Checklist

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

Copilot AI review requested due to automatic review settings November 10, 2025 06:28
@netlify
Copy link
Copy Markdown

netlify bot commented Nov 10, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 183d4c3
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/69118601c88c7900086e5adb

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

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 external module re-exports to use the actual request path instead of the user-facing alias when generating ESM library output. The key issue was that when an external module is aliased (e.g., 'external': 'module path'), the generated re-export statements should use the actual module path ('path') rather than the alias ('external').

Key changes:

  • Added get_request() method to ExternalModule to retrieve the appropriate request value based on the external request type
  • Updated re_export_from_external_module() to use module.get_request().primary() instead of module.user_request() or export_dep.request
  • Removed the export_dep parameter from re_export_from_external_module() as it's no longer needed
  • Added test case for aliased external re-exports

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/rspack_core/src/external_module.rs Added get_request() method to retrieve the correct request value for external modules
crates/rspack_plugin_esm_library/src/link.rs Updated re-export logic to use actual request paths instead of user requests and removed unused parameter
tests/rspack-test/esmOutputCases/externals/aliased/rspack.config.js Added test configuration for aliased external module
tests/rspack-test/esmOutputCases/externals/aliased/index.js Added test case to verify correct export behavior
tests/rspack-test/esmOutputCases/externals/aliased/snapshots/esm.snap.txt Added snapshot showing expected output with actual module path

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 183d4c3 to test: migrate rspack wasm test to rstest (#11990) by CPunisher

❌ Size increased by 384bytes from 47.93MB to 47.93MB (⬆️0.00%)

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Nov 10, 2025

CodSpeed Performance Report

Merging #12136 will not alter performance

Comparing fix/esm-external-request (183d4c3) with main (2c12f2a)

Summary

✅ 17 untouched

@Timeless0911 Timeless0911 merged commit ae75bb5 into main Nov 10, 2025
53 checks passed
@Timeless0911 Timeless0911 deleted the fix/esm-external-request branch November 10, 2025 07:05
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.

3 participants