import HmrServer from './HmrServer';
import { tweakWebpackConfig } from './loader';

export default class NodeHotLoaderWebpackPlugin {
  options;

  /**
   * @param {{
   *  force?: boolean;
   *  fork?: boolean | string[];
   *  args?: string[];
   *  inMemory?: boolean;
   *  logLevel?: string;
   * }} options
   */
  constructor(options) {
    this.options = options;
  }

  /**
   * @param {import('webpack').Compiler} compiler
   */
  apply(compiler) {
    if (!this.options.force && !compiler.options.watch) return;
    tweakWebpackConfig(compiler.options);
    const hmrServer = new HmrServer({ compiler, ...this.options });
    hmrServer.run(false);
  }
}

@@ -334,16 +334,21 @@
 (options
+ = %7B%7D
 ) %7B%0A    

Fix default options