Skip to content

How to enable error display on browser sreen #522

Closed

Description

@applemate

I'd like to show script errors like the screenshot below. Is there a way to do it with webpack devserver

screen shot 2016-07-07 at 2 14 25 pm

Here is my webpack config

entry: './app/index.js',
    output: {
        filename: 'bundle.js',
        path: path.join(__dirname, buildFolder),
        publicPath: publicPath
    },
    devServer: {
        contentBase: buildFolder
    }

Here is I start the dev server:
webpack-dev-server --inline --hot

Activity

  1. SpaceK33z commented on Aug 21, 2016

    @SpaceK33z
    Contributor

    If you use http://localhost:7770, you'll get those errors like that. It means the app itself will be in an iframe though.

    If you want to build this in your app, take a look at #542.

  2. SpaceK33z commented on Sep 4, 2016

    @SpaceK33z
    Contributor

    I'm closing this issue because of inactivity. Feel free to comment, and we can always re-open it again.

  3. applemate commented on Sep 27, 2016

    @applemate
    Author

    I don't see how the reference #542 suggest a solution for this issue. Unless I don't understand it correctly.

  4. SpaceK33z commented on Sep 27, 2016

    @SpaceK33z
    Contributor

    create-react-app actually implemented exactly what you want two days ago: react/create-react-app#744. You could copy the code from there.

  5. lalitkapoor commented on Mar 6, 2017

    @lalitkapoor

    you can add react-dev-utils to your package.json and then add 'react-dev-utils/webpackHotDevClient' to your entry (before your app's starting point) - e.g.:

    entry: {
        'app': [
          'react-hot-loader/patch',
          'react-dev-utils/webpackHotDevClient',
          './public/index.js'
        ]
      },
    
  6. SpaceK33z commented on Mar 6, 2017

    @SpaceK33z
    Contributor

    Note that since v2.3.0, you can use overlay: true in your devServer config. This is essentially the same as react-dev-utils.

  7. mikeaustin commented on Oct 17, 2017

    @mikeaustin

    overlay: true doesn't seem to do anything for me. Am I doing something wrong?

    "webpack-dev-server": "^2.9.2"

    module.exports = {
      ...
      devServer: {
        overlay: true
      }
    }
    
  8. applemate commented on Oct 18, 2017

    @applemate
    Author

    overlay: true does work for me. Not all errors will be shown as overlay

  9. mikeaustin commented on Oct 22, 2017

    @mikeaustin

    I have seen in rare occurrences. I thought it would be shown for all and any errors, but that doesn't seem to be the case.

  10. mikeaustin commented on Feb 2, 2018

    @mikeaustin

    Ahh, it doesn't seem to capture runtime errors...?

    "Uncaught ReferenceError: x is not defined"
    "Uncaught TypeError: window.foo is not a function"

    etc...

  11. JerryChin commented on Nov 26, 2018

    @JerryChin

    Can't capture runtime errors, what a big disappointment.

  12. duartealexf commented on May 22, 2019

    @duartealexf

    That does not make sense, of course it should not capture runtime errors!
    What are try/catch blocks for, anyway?

  13. dfontenot commented on Feb 27, 2023

    @dfontenot

    For anyone with webpack 5.75.0 that is trying to enable / disable this feature:

    devServer: {
      client: {
        overlay: false
      }
    }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions