How to use the react-dev-utils-for-webpack4/WebpackDevServerUtils.choosePort function in react-dev-utils-for-webpack4

To help you get started, we’ve selected a few react-dev-utils-for-webpack4 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 entando / app-builder / scripts / start.js View on Github external
      `Attempting to bind to HOST environment variable: ${chalk.yellow(
    `If this was unintentional, check that you haven't mistakenly set it in your shell.`
  console.log(`Learn more here: ${chalk.yellow('')}`);

// We attempt to use the default port but if it is busy, we offer the user to
// run on a different port. `choosePort()` Promise resolves to the next free port.
  .then(port => {
    if (port == null) {
      // We have not found a port.
    const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
    const appName = require(paths.appPackageJson).name;
    const urls = prepareUrls(protocol, HOST, port);
    // Create a webpack compiler that is configured with custom messages.
    const compiler = createCompiler(webpack, config, appName, urls, useYarn);
    // Load proxy config
    const proxySetting = require(paths.appPackageJson).proxy;
    const proxyConfig = prepareProxy(proxySetting, paths.appPublic);
    // Serve webpack assets generated by the compiler over a web sever.
    const serverConfig = createDevServerConfig(