Explain the basic structure of a Webpack configuration file

Beginner

Answer

A basic webpack.config.js structure:

const path = require('path');

module.exports = {
  mode: 'development', // or 'production'
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  },
  module: {
    rules: [
      // Loader configurations
    ]
  },
  plugins: [
    // Plugin instances
  ],
  resolve: {
    // Module resolution options
  },
  devServer: {
    // Dev server configuration
  }
};