Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(error-logging): rollup errors weren't displaying id and codeframe
The code which modified the error message to have additional context about the module id and code frame where the error originated was relying on the error's stack having never been accessed prior to modifying the error's message. At some point, this no longer was true for Rollup errors, and no context information was being displayed as a result other than the stack trace within the rollup library that doesn't make it clear what or where the problem is. This PR changes the code that add's the id and code-frame context to the error message to also modify the error's stack. To do so, it attempts to extract the original stack trace by removing the existing error message from error.stack if it matches, and otherwise falling back to looking for the stack trace portion by searching for indented lines that look something like: at (file://path/to/file.js or at <annonymout> Some additional normalization was done to the error.frame field if it exists to ensure that consistent padding is used in the error output. Fixes vitejs#16539
- Loading branch information