Automatic resource restart on change in development

Is there a way to automatically restart resources on file save? Similar to a watch flag in node?

Use quake3-rcon to send an ensure resourcename command through rcon to the FXServer.

Here a super old example with the bad restart command instead of ensure :stuck_out_tongue: https://github.com/d0p3t/dope-logging/blob/37a66290d5c2eb8c07468e541db7ec88f840bdb8/server.config.js

Think that repo is privated.

Ah yes it is. Boo

const webpack = require("webpack");
const Q3Rcon = require("quake3-rcon");
const config = require("./.local.json");
const rcon = new Q3Rcon({
  address: config.ip || "127.0.0.1",
  port: config.port || 30120,
  password: config.password
});

const compiler = webpack({
  entry: "./src/server/server.ts",
  mode: "development",
  node: {
    fs: "empty"
  },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: "ts-loader",
        exclude: /node_modules/
      }
    ]
  },
  plugins: [new webpack.DefinePlugin({ "global.GENTLY": false })],
  optimization: {
    minimize: false
  },
  resolve: {
    extensions: [".tsx", ".ts", ".js"]
  },
  output: {
    filename: "server.js",
    path: __dirname + "/dist/"
  },
  target: "async-node"
});

compiler.watch(
  {
    ignored: /node_modules/
  },
  (err, stats) => {
    if (err !== null) {
      console.error(err);
      return;
    }

    console.log(
      `Built new {${stats.hash}} in ${((stats.endTime - stats.startTime) /
        1000) |
        0}s`
    );

    rcon.send(`restart dope-logging`);
  }
);

Thanks for your answer!

What does this do exactly?

Could you possibly explain to me please?