Webpack build is working fine however watch is not working

Viewed 137

I am using command

webpack serve --hot --watch --progress OR webpack serve --hot --progress

to start a server.

Webpack Config file

const path = require("path");
module.exports = {
  mode: "production",
  watch: true,
  watchOptions: {
    ignored: ["**/node_modules"],
  },
  entry: "./source/js/index.js",
  output: {
    path: path.resolve(__dirname, "assets/js"),
    filename: "[name].[contenthash].min.js",
    publicPath: "/assets/",
  },
  devServer: {
    contentBase: path.join(__dirname, "assets"),
    compress: true,
  },
  module: {
    rules: [
      {
        test: /\.m?js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: "babel-loader",
          options: {
            presets: ["@babel/preset-env"],
          },
        },
      },
    ],
  },
};

Console

This is the console output I am getting but webpack is not watching for changes. Although it was watching for changes a few days back. P.S : I am new to webpack.

0 Answers
Related