webpack-contrib / webpack-hot-middleware

Webpack hot reloading you can attach to your own server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature request: customize client-overlay colors

jimblue opened this issue Β· comments

Hi!

First thank you for this amazing webpack middleware πŸ˜„ !

I was wondering it it's possible to add an option to customize client-overlay colors.
I saw it's already depending from a variable here:

https://github.com/glenjamin/webpack-hot-middleware/blob/8654bb51e5a9bcdeac71639975facf03ca9ff471/client-overlay.js#L28

Maybe it's possible to modify this variable when calling webpack-hot-middleware?

Here is the actual look (too faded in my opinion):
screen shot 2017-11-12 at 08 08 32

This is my terminal look of the same output with custom colors:
screen shot 2017-11-12 at 08 08 04

Also is it possible to only output the error without all the at Parser... lines...?

I’d take a PR which did this, yep

I have no idea how to πŸ€• !

Hopefully someone else has the time or interest to pick this up then.

The options parsing would need to be added to client.js and documented in the readme, and then those colours passed over to the overlay code on init.

@glenjamin what about at Parser lines...?

32696774-335dae0c-c781-11e7-8b07-e0e50fa05f36

The overlay handles formatting ANSI codes, so any output that isn't formatted in the source won't be coloured in.

Sorry my question was maybe not clear.
I don't want to display at Parser lines. They don't show up in the console, only in the overlay... why?

I have a PR coming for this shortly. Got the colors working. Looking into the parser lines now.

Ah, those parser lines are because we display the error.stack property instead of just error.message.

For this type of error, the stack trace isn't useful - but in general it is

@glenjamin is it possible to disable it?

I don't think it's possible to know in general whether a given exception's stack trace will be useful

I mean is it possible to completely disable it to have a terminal like output which is more clear.

No, because this feature shows errors.

It just so happens that a babel error contains a message with terminal formatting in it.

Hi @okcoker and thank you very much for this PR, I've just try it!

I was able to customize overlayStyles but not ansiColors.

I've try by copy paste the documention exemple to be sure.

@jimblue did you ever get the ansiColors to work? I'm having trouble as well.

@jimmynotjim nope, still don't work for me 😭

@jimblue @jimmynotjim opened a PR for this #355

Thank you so much @okcoker ! πŸ‘

@glenjamin I've just look to the PR, it was pretty simple in the end 🀣 !
It seems to work on my side, can you confirm?

Resolved in 2.24.4

Hey @glenjamin,

Can you release 2.24.4 on npm please :) ?

Thank you

https://www.npmjs.com/package/webpack-hot-middleware/v/2.24.4 was released shortly before I posted that comment.

Where are you seeing it not be available?

Oh sorry man, it was because of npm cache on my machine... 😭