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 falls back to just displaying the stack trace with its own message since it varies from the error.message. Some additional normalization was done to the error.frame field if it exists to ensure that consistent padding is used in the error output. This is because the rollup code- frame doesn't have new-lines around it, but the esbuild one does. Fixes #16539
- Loading branch information