function spawnWebpackServe(port, dirs, options = {}) {
  const webpackBin = getPackageExecutable('webpack-cli', 'webpack-cli');

  const NODE_OPTIONS = [
    // This requires a script to alias `webpack-dev-server` -
    // both v4 and v5 are installed,
    // so we have to ensure that they resolve to the correct variant.
    WDS_VERSION === 4 && `--require "${require.resolve('./aliasWDSv4')}"`,
  ]
    .filter(Boolean)
    .join(' ');

  return spawnTestProcess(
    webpackBin,
    [
      'serve',
      '--no-color',
      '--no-client-overlay',
      '--config',
      path.join(dirs.root, 'webpack.config.js'),
      '--static-directory',
      dirs.public,
      '--hot',
      '--port',
      port,
    ],
    {
      ...options,
      env: { ...options.env, ...(NODE_OPTIONS && { NODE_OPTIONS }) },
    }
  );
}
@param {number} port
@param {Object} dirs
@param {string} dirs.public
@param {string} dirs.root
@param {string} dirs.src
@param {SpawnOptions} [options]
@returns {Promise<import('child_process').ChildProcess | void>}