title: How i can solve the devServer problem in webpack?
body: <p>I would be grateful for any help or advice. I have compiled the configuration of the webpack, everything works in production mode, but the webpack-dev-server does not see static files and gives the error &quot;Cannot get /&quot;. How can I solve this problem? Thank you in advance for the answer. Here is my webpack.config.js</p>
  <pre><code>const path = require(&quot;path&quot;);
  const { VueLoaderPlugin } = require(&quot;vue-loader&quot;);
  const { CleanWebpackPlugin } = require(&quot;clean-webpack-plugin&quot;);
  const HTMLWebpackPlugin = require(&quot;html-webpack-plugin&quot;);
  const MiniCssExtractPlugin = require(&quot;mini-css-extract-plugin&quot;);
  const CssMinimizerWebpackPlugin = require(&quot;css-minimizer-webpack-plugin&quot;);
  const TerserWebpackPlugin = require(&quot;terser-webpack-plugin&quot;);
  // const autoprefixer = require(&quot;autoprefixer&quot;);
  
  const isProd = process.env.NODE_ENV === &quot;production&quot;;
  const isDev = !isProd;
  
  const optimization = () =&gt; {
    const config = {
      runtimeChunk: &quot;single&quot;,
      splitChunks: {
        cacheGroups: {
          vendor: {
            test: /[\\/]node_modules[\\/]/,
            name: &quot;vendors&quot;,
            priority: -10,
            chunks: &quot;all&quot;,
          },
        },
      },
    };
  
    if (isProd) {
      config.minimizer = [
        new CssMinimizerWebpackPlugin(),
        new TerserWebpackPlugin(),
      ];
    }
  
    return config;
  };
  
  module.exports = {
    entry: path.resolve(__dirname, &quot;src&quot;, &quot;index.js&quot;),
    mode: isProd ? &quot;production&quot; : &quot;development&quot;,
    output: {
      path: path.join(__dirname, &quot;build&quot;),
      filename: &quot;[name].[contenthash:8].js&quot;,
      chunkFilename: &quot;[name].[contenthash:8].js&quot;,
      publicPath: &quot;./&quot;,
    },
    devtool: isDev ? &quot;source-map&quot; : false,
    module: {
      rules: [
        {
          test: /\.js$/,
          exclude: /node_modules/,
          use: {
            loader: &quot;babel-loader&quot;,
          },
        },
        {
          test: /\.vue$/,
          loader: &quot;vue-loader&quot;,
        },
        {
          test: /\.(eot|ttf|woff|woff2)(\?\S*)?$/,
          loader: &quot;file-loader&quot;,
          options: {
            name: &quot;[name][contenthash:8].[ext]&quot;,
          },
        },
        {
          test: /\.(png|jpe?g|gif|webm|mp4|svg)$/,
          loader: &quot;file-loader&quot;,
          options: {
            name: &quot;[name][contenthash:8].[ext]&quot;,
            outputPath: &quot;assets/img&quot;,
            esModule: false,
          },
        },
        {
          test: /\.s?css$/,
          use: [
            &quot;style-loader&quot;,
            {
              loader: MiniCssExtractPlugin.loader,
              options: {
                esModule: false,
              },
            },
            &quot;css-loader&quot;,
          ],
        },
      ],
    },
    plugins: [
      new VueLoaderPlugin(),
      new MiniCssExtractPlugin({
        filename: &quot;[name].[contenthash:8].css&quot;,
        chunkFilename: &quot;[name].[contenthash:8].css&quot;,
      }),
      new HTMLWebpackPlugin({
        template: path.join(__dirname, &quot;src&quot;, &quot;public&quot;, &quot;index.html&quot;),
        filename: &quot;start-page.html&quot;,
        alwaysWriteToDisk: true,
        minify: {
          collapseWhitespace: isProd,
        },
      }),
      new CleanWebpackPlugin(),
    ],
    resolve: {
      alias: {
        vue: &quot;@vue/runtime-dom&quot;,
      },
      extensions: [&quot;*&quot;, &quot;.js&quot;, &quot;.vue&quot;, &quot;.json&quot;],
    },
    optimization: optimization(),
    devServer: {
      compress: true,
      port: 9000,
      hot: true,
      client: {
        overlay: true,
      },
    },
  };
  
  </code></pre>
  <p>Here is a project folders
  <a href="https://i.stack.imgur.com/JS3yW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JS3yW.png" alt="enter image description here" /></a></p>