text: const path = require("path");
  const webpack = require("webpack");
  const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  const HtmlWebpackPlugin = require("html-webpack-plugin");
  const { CleanWebpackPlugin } = require("clean-webpack-plugin");
  const postcssPresetEnv = require("postcss-preset-env");
  
  const devMode = process.env.NODE_ENV !== "production";
  
  const distFolder = path.resolve(__dirname, "dist");
  const srcFolder = path.resolve(__dirname, "src");
  
  module.exports = {
      mode: devMode ? "development" : "production",
      devtool: devMode ? "inline-source-map" : undefined,
      devServer: {
          contentBase: distFolder
      },
      entry: {
          app: ["babel-polyfill", path.resolve(srcFolder, "index.js")]
      },
      output: {
          filename: "[name].bundle.js",
          path: distFolder
      },
      module: {
          rules: [
              {
                  test: /\.s?css$/,
                  use: [
                      {
                          loader: devMode ? "style-loader" : MiniCssExtractPlugin.loader
                      },
                      {
                          loader: "css-loader",
                          options: {
                              sourceMap: true
                          }
                      },
                      {
                          loader: "postcss-loader",
                          options: {
                              ident: "postcss",
                              sourceMap: true,
                              plugins: () => [
                                  postcssPresetEnv()
                              ]
                          }
                      },
                      {
                          loader: "sass-loader",
                          options: {
                              implementation: require("sass"),
                              fiber: require("fibers"),
                              sourceMap: true
                          }
                      }
                  ]
              },
              {
                  test: /\.js$/,
                  exclude: /node_modules/,
                  loader: "babel-loader",
                  options: {
                      presets: ["@babel/preset-env"]
                  }
              }
          ]
      },
      plugins: [
          new CleanWebpackPlugin(),
          new HtmlWebpackPlugin({
              template: path.resolve(srcFolder, "index.html")
          }),
          new MiniCssExtractPlugin({
              filename: "[name].css",
              chunkFilename: "[id].css"
          })
      ]
  }
  