Explain the core concepts of Webpack

Beginner

Answer

Webpack has four core concepts:

  1. Entry: The starting point where Webpack begins building the dependency graph
  2. Output: Where and how to emit the bundles
  3. Loaders: Transform files from different languages/formats into modules
  4. Plugins: Extend Webpack's functionality for optimization, asset management, etc.
module.exports = {
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  },
  module: {
    rules: [{ test: /\.js$/, use: 'babel-loader' }]
  },
  plugins: [new HtmlWebpackPlugin()]
};