fix(transform): wrap VM errors as host Error with filename context#819
Merged
layershifter merged 6 commits intomainfrom Mar 13, 2026
Merged
fix(transform): wrap VM errors as host Error with filename context#819layershifter merged 6 commits intomainfrom
layershifter merged 6 commits intomainfrom
Conversation
Wrap vm.runInContext() errors in Module.evaluate() as proper host Error instances with filename context, fixing NonErrorEmittedError in webpack. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… evaluation mode Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📊 Bundle size report✅ No changes found |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update the VM error test to trigger an error in an imported child module and verify the child filename appears in both message and stack trace. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
da6c9ff to
08065c9
Compare
- Remove redundant filename prefix from re-thrown VM errors (stack trace already contains the filename) - Use toMatchInlineSnapshot() for error message and stack trace assertions - Add webpack-plugin e2e test verifying the full error trace includes the offending imported file Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ally - Replace `replaceAll` with `split/join` for ES2020 compat - Use `path.resolve(__dirname, '...')` instead of hardcoded regex to normalize repo paths, fixing CI where the repo path differs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
miroslavstastny
approved these changes
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
vm.runInContext()errors as proper hostErrorinstances inModule.evaluate(), fixing webpack'sNonErrorEmittedErrorwrapping (VM-context errors failinstanceof Errorin the host)transformSyncerror messagesTest plan
nx test transform— 74 tests passnx test webpack-plugin— 47 tests pass (includes new e2e test asserting the full error trace contains the offending imported file)🤖 Generated with Claude Code