Disable error overlay in development mode

前端 未结 11 967
长情又很酷
长情又很酷 2020-11-30 08:08

Is there a way to disable the error overlay when running a create-react-app in development mode?

This is the overlay I\'m talking about:

I\'m askin

11条回答
  •  庸人自扰
    2020-11-30 08:57

    To avoid bundling in this large dev library disable with a dynamic import:

    yarn add react-error-overlay
    
    if (process.env.NODE_ENV === 'development') {
      import('react-error-overlay').then(m => {
        m.stopReportingRuntimeErrors();
      });
    }
    

提交回复
热议问题