fix: exclude lazy compilation identifier from import traces#6740
fix: exclude lazy compilation identifier from import traces#6740chenjiahan merged 2 commits intomainfrom
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
This PR improves error reporting by filtering out the lazy compilation identifier from module import traces. When lazy compilation is enabled, the proxy identifier (lazy-compilation-proxy) would previously appear in error traces, cluttering the output. The fix extracts this identifier as a constant and uses it consistently to filter traces in two locations.
Key Changes
- Introduced
LAZY_COMPILATION_IDENTIFIERconstant to centralize the lazy compilation proxy string - Updated trace filtering logic in error formatting to exclude lazy compilation proxy modules
- Added test case to verify the filtering behavior
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 |
|---|---|
| packages/core/src/constants.ts | Defines new LAZY_COMPILATION_IDENTIFIER constant for consistent use across codebase |
| packages/core/src/provider/createCompiler.ts | Updates lazy compilation detection to use the new constant instead of hardcoded string |
| packages/core/src/helpers/format.ts | Filters out lazy compilation proxy from module traces to clean up error messages |
| e2e/cases/diagnostic/import-traces-lazy-compilation/src/index.js | Test file with dynamic import to trigger lazy compilation |
| e2e/cases/diagnostic/import-traces-lazy-compilation/src/dynamic.js | Test file with failing import to generate error traces |
| e2e/cases/diagnostic/import-traces-lazy-compilation/index.test.ts | Test case verifying lazy compilation identifier exclusion from traces |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Summary
Filter lazy compilation identifier from module traces to clean up error reporting. Also update related test cases to verify the behavior.
Import traces (entry → error): ./src/index.js - lazy-compilation-proxy|builtin:swc-loader??ruleSet[1].rules[4].use[0]!./dynamic.js ./src/dynamic.js ×Checklist