Customizing the Asset Group Path in Webpack

You can set a save path for each asset group. This is done using the generator setting, specified for each group:

webpack.config.jsexport default {
  entry: './src/index.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve('dist'),
  },
  module: {
    rules: [
      {
        test: /\.png$/,
        type: 'asset/resource',
        generator: {
          filename: 'images/[name].[hash][ext]'
        }
      }
    ]
  },
  plugins: [
    new HtmlWebpackPlugin(),
  ],
};
Задание 1

Place all images with the extension .png in the folder images/png.

Задание 2

Place all images with the extension .jpg in the folder images/jpg.

Задание 3

Place all files with the extension .zip into the folder download.

Задание 4

Place all files with the extension .zip or .rar into the folder download.