#527·craco

Selectively suppress webpack runtime errors?

Author: francisashleyCreated Oct 3, 2023Updated Dec 31, 2024
Labelsbug

We can disable all runtimeErrors from appearing in the error overlay with https://webpack.js.org/configuration/dev-server/#overlay:

module.exports = () => {
  return {
    devServer: {
      client: {
        overlay: {
          runtimeErrors: false
        }
      }
    }
  };
};

However attempting to provide the handler function

module.exports = () => {
  return {
    devServer: {
      client: {
        overlay: {
          runtimeErrors: (error) => {
              return true;
            }
          }
        }
      }
    }
  };
};

throws the error Invalid options object. Dev Server has been initialized using an options object that does not match the API schema..

Screenshot 2023-10-03 at 18 35 17

Is this easy to resolve? Thanks

CRACO version

7.1.0