Do you want to request a feature or report a bug?
I would classify this as a bug, but I don't know it might be a question. I asked on the gitter, but no one responded.
What is the current behavior?
I get this output when there's an error on the console in the web browser. It works fine on the terminal though. Not sure if this is a webpack bug then or not, who knows.
Does anyone know how I can stop webpack from outputting garbledy gook like this?
[0m [90m 10 | [39m
[90m 11 | [39m[36mexport[39m [36mdefault[39m [36mfunction[39m [33mSVG[39m() {
[31m[1m>[22m[39m[90m 12 | [39m [36mreturn[39m [33m<[39m[33mdiv[39m id[33m=[39m[32m"svg-container"[39m [33m<[39m[33msvg[39m [36mclass[39m[33m=[39m[32m"circle"[39m xmlns[33m=[39m[32m"http://www.w3.org/2000/svg"[39m[33m>[39m
[90m | [39m [31m[1m^[22m[39m
[90m 13 | [39m [33m<[39m[33mcircle[39m
[90m 14 | [39m cx[33m=[39m[32m"50"[39m
[90m 15 | [39m cy[33m=[39m[32m"50"[39m[0m
I'm using webpack and react and babel, so, I don't know which package is responsible or which one can fix it.
If the current behavior is a bug, please provide the steps to reproduce.
clone my repo https://github.com/zwhitchcox/webpack-react-starter
Then, make any error in the react code. I'm assuming you guys know react. For example, a malformed jsx closing tag like
[0m [90m 10 | [39m
[90m 11 | [39m[36mexport[39m [36mdefault[39m [36mfunction[39m [33mSVG[39m() {
[31m[1m>[22m[39m[90m 12 | [39m [36mreturn[39m [33m<[39m[33mdiv[39m id[33m=[39m[32m"svg-container"[39m [33m<[39m[33msvg[39m [36mclass[39m[33m=[39m[32m"circle"[39m xmlns[33m=[39m[32m"http://www.w3.org/2000/svg"[39m[33m>[39m
[90m | [39m [31m[1m^[22m[39m
[90m 13 | [39m [33m<[39m[33mcircle[39m
[90m 14 | [39m cx[33m=[39m[32m"50"[39m
[90m 15 | [39m cy[33m=[39m[32m"50"[39m[0m
What is the expected behavior?
I would expect the output to be cleanly shown like in the terminal:
ERROR in ./src/app.js
Module build failed: SyntaxError: Unterminated JSX contents (30:14)
28 |
29 |
30 | render(
, document.querySelector('#app'))
| ^
31 |
Please mention your webpack and Operating System version.
webpack 3.5.5, Ubuntu 14.04
The console you're using doesn't support ansi color codes or is flipping out for some weird reason. Especially strange on Ubuntu. If that's being output in the browser console, then that's an entirely different issue - something I've never seen a single test or example do. That's going to be an issue with your environment or app setup I'm afraid. To triage an app, start with one of our known-working examples and slowly add bits of your config/app until it errors, and that should show you the trouble maker.
Closing as a question.
But that can't be right, because it works when I run webpack-dev-server from the command line, and that gets run on the same environment. I haven't been able to find an react example with the webpack-dev-server node api
Clues to debug your particular issue can be found in the gobbly goop...
"http://www.w3.org/2000/svg"
"svg-container"
I'd start there within your project. You don't need a react example to start piecing together a reproducible environment. Start with the node-api example and build it up piece by piece until your issue is replicated, and that'll probably give you the cause.
I've verified that it does the same thing on other machines, so if you were to clone the repo, it would even do it on your machine. Again, it only does it with the node api, not from command line. the "http://www.w3.org/2000/svg" is just the jsx I was using. If I made a different error in the jsx, it would output that.
Ok, I went ahead and copied the webpack-dev-server node-api example, and the only thing I changed was to add the babel-preset-react to it, and it outputs the garbly gook. https://github.com/zwhitchcox/webpack-dev-server-bug
So, the webpack-dev-server from the command line works, fine and only outputs the garbldy gook with the node api. Is this the intended behavior? It doesn't seem like very good design. If this is a bug, will you please reopen this issue.
I think this issue still exists, even if it was described poorly here. The issue is that when WDS triggers a browser reload and the build fails, the error is output to the browser console (as expected) with the ANSI color codes included (not expected), resulting in the aforementioned "Garbledeygook". Screenshots for clarity:
Terminal output (looks great):

Chrome console:

webpack: 4.36.1
webpack-dev-server: 3.7.2
@swrobel How to resolve this issue?
@neilveil I submitted a PR that fixes it, but it got rejected. #1066 You can use the code from that though.
People on this repo aren't the friendliest unfortunately :(
@neilveil If you're using react, feel free to clone my template repo which proxies a connection to the create-react-app dev server.
https://github.com/zwhitchcox/ref-express-react
They're pretty much worked out all the kinks. I think this issue still crops up though.
Please provide reproducible test repo, I will look at the problem
This is not an issue with the webpack
Check this issue here #893 that I've created on babel repo with steps to reproduce.
@zwhitchcox @swrobel
Most helpful comment
This is not an issue with the webpack
Check this issue here #893 that I've created on babel repo with steps to reproduce.
@zwhitchcox @swrobel