text: const path = require('path')
  const HtmlWebpackPlugin = require('html-webpack-plugin')
  const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin')
  
  const isDevelopment = process.env.NODE_ENV !== 'production'
  
  module.exports = {
    mode: isDevelopment ? 'development' : 'production',
    resolve: {
      extensions: ['.tsx', '.ts', '.js']
    },
    entry: path.resolve(__dirname, 'src', 'index.tsx'),
    module: {
      rules: [
        {
          test: /\.(js|ts|tsx)$/,
          exclude: /node_modules/,
          use: {
            loader: 'babel-loader'
          }
        },
        {
          test: /\.svg$/,
          exclude: /node_modules/,
          use: {
            loader: 'file-loader',
            options: {
              name: 'images/[hash]-[name].[ext]'
            }
          }
        }
      ]
    },
    devServer: {
      contentBase: path.join(__dirname, 'public'),
      historyApiFallback: true,
      hot: true,
      port: 3000
    },
    output: {
      path: path.resolve(__dirname, 'dist'),
      filename: 'bundle.js'
    },
    plugins: [
      new HtmlWebpackPlugin({
        template: path.resolve(__dirname, 'public', 'index.html')
      }),
      isDevelopment && new ReactRefreshWebpackPlugin()
    ].filter(Boolean)
  }
  