How to use the webpack-hot-middleware/client.useCustomOverlay function in webpack-hot-middleware

To help you get started, we’ve selected a few webpack-hot-middleware examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lskjs / lskjs / packages / lsk-modules / packages / build / src / webpackHotDevClient.js View on Github external
startReportingRuntimeErrors,
  stopReportingRuntimeErrors,
} from 'react-error-overlay';

setEditorHandler(errorLocation => {
  console.log('setEditorHandler', errorLocation);
  
  const fileName = encodeURIComponent(errorLocation.fileName);
  const lineNumber = encodeURIComponent(errorLocation.lineNumber || 1);
  fetch(
    // Keep in sync with react-dev-utils/errorOverlayMiddleware
    `${launchEditorEndpoint}?fileName=${fileName}&lineNumber=${lineNumber}`,
  );
});

hotClient.useCustomOverlay({
  showProblems(type, errors) {
    const formatted = formatWebpackMessages({
      errors,
      warnings: [],
    });

    reportBuildError(formatted.errors[0]);
  },
  clear() {
    dismissBuildError();
  },
});

hotClient.setOptionsAndConnect({
  name: 'client',
  reload: true,
github lskjs / lskjs / packages / lsk-build / src / webpackHotDevClient.js View on Github external
startReportingRuntimeErrors,
  stopReportingRuntimeErrors,
} from 'react-error-overlay';

setEditorHandler(errorLocation => {
  console.log('setEditorHandler', errorLocation);
  
  const fileName = encodeURIComponent(errorLocation.fileName);
  const lineNumber = encodeURIComponent(errorLocation.lineNumber || 1);
  fetch(
    // Keep in sync with react-dev-utils/errorOverlayMiddleware
    `${launchEditorEndpoint}?fileName=${fileName}&lineNumber=${lineNumber}`,
  );
});

hotClient.useCustomOverlay({
  showProblems(type, errors) {
    const formatted = formatWebpackMessages({
      errors,
      warnings: [],
    });

    reportBuildError(formatted.errors[0]);
  },
  clear() {
    dismissBuildError();
  },
});

hotClient.setOptionsAndConnect({
  name: 'client',
  reload: true,
github thetribeio / node-react-starter-kit / tools / lib / webpackHotDevClient.js View on Github external
reportBuildError,
    dismissBuildError,
    startReportingRuntimeErrors,
    stopReportingRuntimeErrors,
} from 'react-error-overlay';

setEditorHandler((errorLocation) => {
    const fileName = encodeURIComponent(errorLocation.fileName);
    const lineNumber = encodeURIComponent(errorLocation.lineNumber || 1);

    // Keep in sync with react-dev-utils/errorOverlayMiddleware
    // eslint-disable-next-line no-undef
    fetch(`${launchEditorEndpoint}?fileName=${fileName}&lineNumber=${lineNumber}`);
});

hotClient.useCustomOverlay({
    showProblems(type, errors) {
        reportBuildError(formatWebpackMessages({ errors, warnings: [] }).errors[0]);
    },
    clear() {
        dismissBuildError();
    },
});

hotClient.setOptionsAndConnect({ name: 'client', reload: true });

startReportingRuntimeErrors({ filename: '/assets/client.js' });

if (module.hot) {
    module.hot.dispose(stopReportingRuntimeErrors);
}
github labzero / lunch / tools / lib / webpackHotDevClient.js View on Github external
reportBuildError,
  dismissBuildError,
  startReportingRuntimeErrors,
  stopReportingRuntimeErrors,
} from 'react-error-overlay';

setEditorHandler(errorLocation => {
  const fileName = encodeURIComponent(errorLocation.fileName);
  const lineNumber = encodeURIComponent(errorLocation.lineNumber || 1);
  fetch(
    // Keep in sync with react-dev-utils/errorOverlayMiddleware
    `${launchEditorEndpoint}?fileName=${fileName}&lineNumber=${lineNumber}`,
  );
});

hotClient.useCustomOverlay({
  showProblems(type, errors) {
    const formatted = formatWebpackMessages({
      errors,
      warnings: [],
    });

    reportBuildError(formatted.errors[0]);
  },
  clear() {
    dismissBuildError();
  },
});

hotClient.setOptionsAndConnect({
  name: 'client',
  reload: true,
github hisschemoller / volca-freesound / tools / lib / webpackHotDevClient.js View on Github external
startReportingRuntimeErrors,
  stopReportingRuntimeErrors,
} from 'react-error-overlay';

window.EventSource = NativeEventSource || EventSourcePolyfill;

setEditorHandler(errorLocation => {
  const fileName = encodeURIComponent(errorLocation.fileName);
  const lineNumber = encodeURIComponent(errorLocation.lineNumber || 1);
  fetch(
    // Keep in sync with react-dev-utils/errorOverlayMiddleware
    `${launchEditorEndpoint}?fileName=${fileName}&lineNumber=${lineNumber}`,
  );
});

hotClient.useCustomOverlay({
  showProblems(type, errors) {
    const formatted = formatWebpackMessages({
      errors,
      warnings: [],
    });

    reportBuildError(formatted.errors[0]);
  },
  clear() {
    dismissBuildError();
  },
});

hotClient.setOptionsAndConnect({
  name: 'client',
  reload: true,
github kriasoft / app-starter-kit / web / tools / lib / webpackHotDevClient.js View on Github external
*
 * This source code is licensed under the MIT license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */

import hotClient from 'webpack-hot-middleware/client';
import launchEditorEndpoint from 'react-dev-utils/launchEditorEndpoint';
import formatWebpackMessages from 'react-dev-utils/formatWebpackMessages';
import {
  reportBuildError,
  dismissBuildError,
  startReportingRuntimeErrors,
  stopReportingRuntimeErrors,
} from 'react-error-overlay';

hotClient.useCustomOverlay({
  showProblems(type, errors) {
    const formatted = formatWebpackMessages({
      errors,
      warnings: [],
    });

    reportBuildError(formatted.errors[0]);
  },
  clear() {
    dismissBuildError();
  },
});

hotClient.setOptionsAndConnect({
  name: 'client',
  reload: true,