-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nicer looking overlay #9
Comments
Related: gaearon/react-transform-boilerplate#18 What do you think about using https://github.com/KeywordBrain/redbox-react ? |
I'd rather not force a dependency on react - especially as there are many more things that can break with a react rendering. |
I hacked up a proof of concept using ansi-to-html: I had to tweak its dependency ( |
If anybody wants to prepare a real PR here’s what I did: In clientOverlay.style.background = '#111';
clientOverlay.style.color = 'fff';
// ...
function showProblems(lines) {
clientOverlay.innerHTML = '';
clientOverlay.style.display = 'block';
lines.forEach(function(msg) {
var div = document.createElement('div');
div.innerHTML = msg; // <-------------------- not innerText
clientOverlay.appendChild(div);
});
}; In var strip = require('strip-ansi');
var Ansi = require('ansi-to-html'); // <----------- new stuff (as explained above we might need to create UMD for it)
var ansi = new Ansi();
var overlay;
if (typeof document !== 'undefined' && options.overlay) {
overlay = require('./client-overlay');
}
function problems(type, obj) {
if (options.warn) console.warn("[HMR] bundle has " + type + ":");
var list = [];
obj[type].forEach(function(msg) {
if (options.warn) console.warn("[HMR] " + strip(msg));
list.push(ansi.toHtml(msg)); // <---------------------------- convert here
});
if (overlay && type !== 'warnings') overlay.showProblems(list);
} |
Nice idea, I reckon a pre-built version of ansi to HTML is reasonable. |
One thing to watch for is that we should enable the |
If anyone wants to me the error overlay neater, or add visual feedback for success similarly to figwheel - please go ahead and submit a PR
The text was updated successfully, but these errors were encountered: