Robert_JR

webpack

Jul 1st, 2021 (edited)
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const HtmlWebpackPlugin = require('html-webpack-plugin');
  2. const path = require('path');
  3. const webpack = require('webpack');
  4. const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  5. const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
  6.  
  7. module.exports = {
  8.   entry: {
  9.     index: "/home/robert/www/src/index.js",
  10.     im1: "/home/robert/www/src/im1.js",
  11.     "another/im1": "/home/robert/www/src/another/im1.js",
  12.     "css/index": "/home/robert/www/src/main.css"
  13.   },
  14.   module: {
  15.     rules: [
  16.       {
  17.         test: /\.css$/,
  18.         use: [MiniCssExtractPlugin.loader, "css-loader"],
  19.       },
  20.       {
  21.         test: /\.(png|svg|jpg|jpeg|gif)$/i,
  22.         type: 'asset/resource',
  23.       },
  24.     ],
  25.   },
  26.   plugins: [new MiniCssExtractPlugin()],
  27.  
  28.   optimization: {
  29.     minimizer: [
  30.       // For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
  31.       // `...`,
  32.       new CssMinimizerPlugin(),
  33.     ],
  34.   },
  35. };
  36.  
Add Comment
Please, Sign In to add comment