Skip to content

fix: external resolve esm module#11144

Merged
fi3ework merged 2 commits intomainfrom
fix-external-resolve
Jul 23, 2025
Merged

fix: external resolve esm module#11144
fi3ework merged 2 commits intomainfrom
fix-external-resolve

Conversation

@SyMind
Copy link
Member

@SyMind SyMind commented Jul 23, 2025

Summary

This PR fixes an issue with external module resolution in Rspack, specifically addressing how ESM modules are resolved during the external resolution process. The fix corrects the dependency category and resolve context being passed to the resolver.

Related links

Checklist

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

Copilot AI review requested due to automatic review settings July 23, 2025 07:25
@SyMind SyMind requested a review from h-a-n-a as a code owner July 23, 2025 07:25
@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 Jul 23, 2025
Copy link
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 an issue with external module resolution in Rspack, specifically addressing how ESM modules are resolved during the external resolution process. The fix corrects the dependency category and resolve context being passed to the resolver.

  • Corrects resolver configuration to use the proper dependency category and context
  • Adds comprehensive test coverage for external resolution with both ESM and CommonJS modules
  • Ensures external modules resolve to the correct module type based on import syntax

Reviewed Changes

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

File Description
crates/rspack_binding_api/src/raw_options/raw_external.rs Fixes resolver configuration by using first_clone instead of second_clone for dependency category and resolve context
packages/rspack-test-tools/tests/configCases/externals/get-resolve/rspack.config.js Adds test configuration for external resolution with custom logic to handle both .mjs and .cjs files
packages/rspack-test-tools/tests/configCases/externals/get-resolve/index.js Adds test cases verifying correct resolution of external modules via require() and import()

@netlify
Copy link

netlify bot commented Jul 23, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit ba0df5a
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6880906d8540540008fe8ea8

@SyMind SyMind force-pushed the fix-external-resolve branch from c120c64 to ba0df5a Compare July 23, 2025 07:34
@SyMind SyMind requested a review from fi3ework July 23, 2025 07:42
@github-actions
Copy link
Contributor

📦 Binary Size-limit

Comparing ba0df5a to chore(wasm): use release-wasi profile (#11131) by CPunisher

🙈 Size remains the same at 49.00MB

@fi3ework fi3ework enabled auto-merge (squash) July 23, 2025 07:51
@codspeed-hq
Copy link

codspeed-hq bot commented Jul 23, 2025

CodSpeed Performance Report

Merging #11144 will not alter performance

Comparing fix-external-resolve (ba0df5a) with main (b77da21)

Summary

✅ 16 untouched benchmarks

@fi3ework fi3ework merged commit 2622024 into main Jul 23, 2025
44 checks passed
@fi3ework fi3ework deleted the fix-external-resolve branch July 23, 2025 07: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.

3 participants