How to Remove Generated License File Webpack

It appears that you want to remove the generation of license comments in your webpack bundle. To achieve this, you can set the extractComments option of the TerserPlugin to false. This will prevent the plugin from extracting and adding license comments to your bundle. Here’s how you can modify your webpack configuration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');

module.exports = {
   optimization: {
      minimize: true,
      minimizer: [
         new TerserPlugin({
            extractComments: false, // Set this option to false
         }),
      ],
   },
   entry: './web/src/js/main.js',
   output: {
      filename: 'bundle.js',
      path: path.resolve(__dirname, 'web', 'static', 'assets', 'js'),
   }
};

By setting extractComments to false, the TerserPlugin will not include license comments in your minified bundle. This should help you achieve your goal of removing the generated license file from your webpack output.

0%