Skip to content

Webpack 5 dev server doesn't show detail error in overlay #2786

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

Closed
xkelvinx666 opened this issue Oct 23, 2020 · 19 comments
Closed

Webpack 5 dev server doesn't show detail error in overlay #2786

xkelvinx666 opened this issue Oct 23, 2020 · 19 comments

Comments

@xkelvinx666
Copy link

Bug report

the dev server doesn't show detail error in overlay in webpack 5

What is the current behavior?

the overlay message doesn't show the compiler error, maybe the error scheme change in webpack 5?

image

If the current behavior is a bug, please provide the steps to reproduce.

git clone https://github.com/cvgellhorn/webpack-boilerplate
vi webpack.dev.js # add overlay in devServer
npm run dev

What is the expected behavior?

show the detail error like webpack4

Other relevant information:
webpack version: 5.2.0
Node.js version: 14.8.0
Operating System: mac os 10.14.6
Additional tools: npm v6

@webpack-bot
Copy link

For maintainers only:

  • webpack-4
  • webpack-5
  • bug
  • critical-bug
  • enhancement
  • documentation
  • performance
  • dependencies
  • question

@alexander-akait
Copy link
Member

No problems in webpack

@alexander-akait alexander-akait transferred this issue from webpack/webpack Oct 23, 2020
@thormeier
Copy link

thormeier commented Oct 27, 2020

Just encountered the exact same and tracked it down to client/overlay.js:L115:

function showMessage(messages) {
  ensureOverlayDivExists(function (div) {
    // Make it look similar to our terminal.
    div.innerHTML = "<span style=\"color: #".concat(colors.red, "\">Failed to compile.</span><br><br>").concat(ansiHTML(entities.encode(messages[0])));
  });
}

Inspecting the error messages shows that they are actually objects containing a message key. It's working when I change it to:

div.innerHTML = "<span style=\"color: #".concat(colors.red, "\">Failed to compile.</span><br><br>").concat(ansiHTML(entities.encode(messages[0].message)));

@alexander-akait
Copy link
Member

Yes, but we need to keep compatibility with webpack@4, so need to check messages[0].message? messages[0].message : messages[0]

@xkelvinx666
Copy link
Author

Yes, but we need to keep compatibility with webpack@4, so need to check messages[0].message? messages[0].message : messages[0]

Would you plan to fix it?

@ckken
Copy link

ckken commented Nov 3, 2020

Would you plan to fix it?

@snitin315
Copy link
Member

I will send a fix.

@alexander-akait
Copy link
Member

alexander-akait commented Nov 19, 2020

Fixed in v4 branch (release will be soon)

@jimblue
Copy link

jimblue commented Feb 7, 2021

Hi @alexander-akait,
Is it possible to re open this issue as V4 isn't released yet.
Thank you 😄

@alexander-akait
Copy link
Member

We already have the issue for v4

@jimblue
Copy link

jimblue commented Feb 8, 2021

ok great, thank you

@szegheo
Copy link

szegheo commented Mar 16, 2021

Hmm.. Reading the above it should be ok/fixed in Webpack 5.26.1 (I'm using now), but I see "Failed to compile." only. Is it only for me?

@jimblue
Copy link

jimblue commented Mar 16, 2021

@coderars when @alexander-akait was telling above that this issue will be fixed in V4, he was talking about webpack-dev-server V4

@neemzy
Copy link

neemzy commented Apr 9, 2021

Is it supposed to be fixed in webpack-dev-server@3? I'm facing this issue right now.

@jimblue
Copy link

jimblue commented Apr 9, 2021

Is it supposed to be fixed in webpack-dev-server@3? I'm facing this issue right now.

@neemzy If you're using Webpack 5 you have to use webpack dev server with the latest beta version.

@neemzy
Copy link

neemzy commented Apr 9, 2021

@jimblue Why? Neither README says so. I'm kinda weirded out by the fact using a non-stable version of the dev server with the latest stable version of Webpack itself would be mandatory.

@jordanbtucker
Copy link

I agree with @neemzy. How about releasing the fix has a hotfix for v3 while everyone waits for v4 to get released?

@EvgenyLeukhin
Copy link

I think, this is not Webpack 5 problem, this is problem with version of webpack-dev-server.
You may try to install "webpack-dev-server": "^4.0.0-beta.3" to fix it.

@neemzy
Copy link

neemzy commented Jun 23, 2021

@EvgenyLeukhin I understand, but as I stated above, I don't see any good reason for encouraging people to use a beta version of the dev server with a stable version of Webpack rather than backporting the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests