-
-
Notifications
You must be signed in to change notification settings - Fork 760
fix(rstest): hoist importActual ESM imports #13025
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
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
Fixes an ordering issue where importActual ESM imports need to be emitted/initialized before rstest mock-hoist placeholders so that mocked-module factories can safely spread/use the “actual” namespace import.
Changes:
- Override Rspack’s ESM import dependency templates to hoist
StageESMImportsinit fragments when the import haswith { rstest: "importActual" }. - Add an
importActualhoist marker comment in generated output for easier verification/debugging. - Extend rstest mock config-case coverage with a loader rule for
importActualimport-attributes and a newimportActualHoistedentry test.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/rspack-test/configCases/rstest/mock/rspack.config.js | Updates test runtime mock implementation; adds loader rule for with { rstest: "importActual" }; adds new test entry. |
| tests/rspack-test/configCases/rstest/mock/importActualLoader.mjs | Adds a passthrough loader used to create a distinct module instance for importActual via import attributes. |
| tests/rspack-test/configCases/rstest/mock/importActualHoisted.js | Adds a regression test for importActual used in a mocked module factory when imports are hoisted. |
| crates/rspack_plugin_rstest/src/plugin.rs | Registers new dependency templates to override ESM import rendering for importActual ordering. |
| crates/rspack_plugin_rstest/src/lib.rs | Wires in the new esm_import_dependency module. |
| crates/rspack_plugin_rstest/src/esm_import_dependency.rs | Implements ESM import template overrides that hoist StageESMImports fragments for importActual. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
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 6.88KB from 48.68MB to 48.68MB (⬆️0.01%) |
Merging this PR will not alter performance
Comparing Footnotes
|
Deploying rspack with
|
| Latest commit: |
65efcb4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a03ceb40.rspack-v2.pages.dev |
| Branch Preview URL: | https://importactual-hoisted.rspack-v2.pages.dev |
Summary
fix(rstest): rstest
importActual+ import mocked module ordering issue.importActualattributeRelated links
Checklist