Webpack - omit creation of LICENSE.txt files

To properly remove both the license file and the comments inside the bundle use:

optimization: {
  minimize: true,
  minimizer: [
    new TerserPlugin({
      extractComments: false,
      terserOptions: {
        format: {
          comments: false,
        },
      },
    }),
  ],
},

https://github.com/webpack-contrib/terser-webpack-plugin#remove-comments


Add extractComments: false to webpack.config.js


const TerserPlugin = require('terser-webpack-plugin');
.
.
.
module.exports = {
.
.
.
  optimization: {
    minimizer: [new TerserPlugin({
      extractComments: false,
    })],
  },
.
.
.
};

Tags:

Webpack