How to use the react-dev-utils/errorOverlayMiddleware function in react-dev-utils

To help you get started, we’ve selected a few react-dev-utils 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 / Runner / tools / start.js View on Github external
async function start() {
  if (this.server) return this.server;
  await this.run(this.clean);
  await this.traceWebpackConfig();

  this.server = express();
  this.server.use(errorOverlayMiddleware());
  this.server.use(express.static(path.resolve(__dirname, this.resolveDist('../public'))));
  // Configure client-side hot module replacement
  const clientConfig = this.webpackConfig.find(config => config.name === 'client');
  // clientConfig.entry.client = [__dirname + '/tools/lib/webpackHotDevClient.js']
  clientConfig.entry.client = ['../node_modules/@lskjs/build/webpackHotDevClient.js']
    .concat(clientConfig.entry.client)
    .sort((a, b) => b.includes('polyfill') - a.includes('polyfill'));
  clientConfig.output.filename = clientConfig.output.filename.replace(
    'chunkhash',
    'hash',
  );
  clientConfig.output.chunkFilename = clientConfig.output.chunkFilename.replace(
    'chunkhash',
    'hash',
  );
  clientConfig.module.rules = clientConfig.module.rules.filter(x => x.loader !== 'null-loader');
github interactivethings / catalog / packages / cli / src / actions / runDevServer.ts View on Github external
before(app: any) {
      // Next.js serves static files from /static – which can't be configured with `contentBase` directly
      // if (framework === "NEXT") {
      //   app.use("/static", express.static(paths.appStaticSrcDir));
      // }
      // This lets us open files from the runtime error overlay.
      app.use(errorOverlayMiddleware());
    }
  });
github expo / expo-cli / packages / webpack-config / src / addons / withDevServer.ts View on Github external
before(app, server) {
      // if (fs.existsSync(paths.proxySetup)) {
      //   // This registers user provided middleware for proxy reasons
      //   require(paths.proxySetup)(app);
      // }

      // This lets us fetch source contents from webpack for the error overlay
      app.use(evalSourceMapMiddleware(server));
      // This lets us open files from the runtime error overlay.
      app.use(errorOverlayMiddleware());

      // This service worker file is effectively a 'no-op' that will reset any
      // previous service worker registered for the same host:port combination.
      // We do this in development to avoid hitting the production cache if
      // it used the same host and port.
      // https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432
      app.use(noopServiceWorkerMiddleware());
    },
github lskjs / lskjs / packages / lsk-build / src / Runner / tools / start.js View on Github external
async function start() {
  if (this.server) return this.server;
  await this.run(this.clean);
  await this.traceWebpackConfig();

  this.server = express();
  this.server.use(errorOverlayMiddleware());
  this.server.use(express.static(path.resolve(__dirname, this.resolveDist('../public'))));
  // Configure client-side hot module replacement
  const clientConfig = this.webpackConfig.find(config => config.name === 'client');
  // clientConfig.entry.client = [__dirname + '/tools/lib/webpackHotDevClient.js']
  clientConfig.entry.client = ['../node_modules/@lskjs/build/webpackHotDevClient.js']
    .concat(clientConfig.entry.client)
    .sort((a, b) => b.includes('polyfill') - a.includes('polyfill'));
  clientConfig.output.filename = clientConfig.output.filename.replace(
    'chunkhash',
    'hash',
  );
  clientConfig.output.chunkFilename = clientConfig.output.chunkFilename.replace(
    'chunkhash',
    'hash',
  );
  clientConfig.module.rules = clientConfig.module.rules.filter(x => x.loader !== 'null-loader');
github flatlogic / react-dashboard / tools / start.js View on Github external
async function start() {
  if (server) return server;
  server = express();
  server.use(errorOverlayMiddleware());
  server.use(express.static(path.resolve(__dirname, '../public')));

  // Configure client-side hot module replacement
  const clientConfig = webpackConfig.find(config => config.name === 'client');
  clientConfig.entry.client = ['./tools/lib/webpackHotDevClient']
    .concat(clientConfig.entry.client)
    .sort((a, b) => b.includes('polyfill') - a.includes('polyfill'));
  clientConfig.output.filename = clientConfig.output.filename.replace(
    'chunkhash',
    'hash',
  );
  clientConfig.output.chunkFilename = clientConfig.output.chunkFilename.replace(
    'chunkhash',
    'hash',
  );
  clientConfig.module.rules = clientConfig.module.rules.filter(
github codejamninja / reactant / packages / web / src / webpack.js View on Github external
before(app) {
          app.use(errorOverlayMiddleware());
        },
        contentBase: path.resolve(paths.dist),
github smooth-code / error-overlay-webpack-plugin / src / index.js View on Github external
options.devServer.before = (app, server) => {
          if (originalBefore) {
            originalBefore(app, server)
          }
          app.use(errorOverlayMiddleware())
        }
      }