What is must be in the webpack production mode for react project?

The current webpack file is such;

const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = {
  output: {
    path: path.join(__dirname, "/dist"),
    filename: "index.bundle.js",
    publicPath: "/",
  },
  devServer: {
    port: 3010,
    watchContentBase: true,
  },
  entry: ["@babel/polyfill", "./src/index.js"],
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
        },
      },
      {
        test: /\.scss$/,
        use: [
          {
            loader: "style-loader",
          },
          {
            loader: "css-loader",
          },
          {
            loader: "sass-loader",
          },
        ],
      },
      {
        test: /\.(png|jpg)$/,
        loader: "url-loader",
      },
    ],
  },
  devServer: {
    historyApiFallback: true,
  },
  plugins: [new MiniCssExtractPlugin()],
};

What is the necessary or must for react? For example browser compatibility, performance.

I haven’t done any React yet, but maybe these links will help…

  1. Bundling a React project using Webpack and Babel

    • Scroll down and see the section:
      Configuring Webpack to our project
  2. How to enable production mode in
    React?

  3. Webpack Production Mode

If not, sorry. Perhaps I’ve misunderstood.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.