HMR Overlay: Full-color error messages #8327
Replies: 2 comments 5 replies
-
Looks nice to me!
AFAIK there is not.
My only concern is about performance if it is going to use something like |
Beta Was this translation helpful? Give feedback.
-
As an update for anyone who is interested, I was able to modify the vite-plugin-elm project to meet my needs, without any core changes to how Vite works!
Vite's Plugin API and docs made this super easy to work with- and it enabled me to build this in a couple of hours. The overlay is used in my open source project, so I wanted to share the related PR here: Thanks again, Vite team! |
Beta Was this translation helpful? Give feedback.
-
Hello everyone! 👋
This is my first discussion post in the Vite community, and I want to start by thanking you all for the hard work you've put into making this free open-source tool for everyone. I totally understand if it doesn't align with Vite's design philosophy, but would love to hear your thoughts!
Context
I'm hoping to use Vite to power the dev server for a new framework I'm building for the Elm language. In the Elm community, we benefit from our compiler's friendly error messages.
The author of the language, Evan, has made the error messages really easy to read. One of the ways he does this is by strategically using color. This guides the reader's eyes to the most important parts of the error.
Here's a visual example of an Elm compiler error message:
My goal is to see error messages like these in the browser, with Vite's built-in HMR overlay. I'm currently using vite-plugin-elm, which allows me to use Vite with
.elm
files.Problem
Here's an example of that same error message, but rendered today in Vite's HMR overlay with vite-plugin-elm:
As you can see, the error message is coming back completely red. This makes it more difficult to find the emphasized parts of the error.
I looked into the code powering "vite-plugin-elm", to see if I could make changes to the plugin, but discovered that the error color is a part of the core Vite experience.
Suggestion
By adjusting a local copy of the Vite source code, I was able to make Vite provide Elm error messages in the browser in full-color:
Although I was happy with my hack, an actual community solution needs to:
Summary
Rather than trying to solve all those problems with code, I thought it would be a good idea to discuss the idea with the Vite community. Specifically, I'd love to understand:
Thanks!
Ryan
Beta Was this translation helpful? Give feedback.
All reactions