Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webpack - omit creation of LICENSE.txt files

Tags:

webpack

I'm using Webpack 5 and along with the bundle.js file a bundle.js.LICENSE.txt file is created which is not needed, because https://github.com/codepunkt/webpack-license-plugin is used for this task.

Is there any way to configure Webpack to omit the creation of LICENSE.txt files?

I've searched the webpack docs, SO and several issues on GitHub but didn't find anything helpful.

like image 623
pathmapper Avatar asked Nov 13 '20 09:11

pathmapper


People also ask

What is Webpack and how to use it?

Webpack enables use of loaders to preprocess files. This allows you to bundle any static resource way beyond JavaScript. You can easily write your own loaders using Node.js.

What is the latest version of license TXT?

The first release of LICENSE.txt for the Windows 8.1 platform was on 10/18/2013 for Windows 8.1. The latest file version for Adobe Photoshop Elements 2020 is v2020 released on 10/01/2019. LICENSE.txt is included in Adobe Photoshop Elements 2020, Microsoft Office PowerPoint 2010 14, and 7-Zip 19.

Why is my license txt file missing?

Your LICENSE.txt file could be missing due to accidental deletion, uninstalled as a shared file of another program (shared with Adobe Photoshop Elements), or deleted by a malware infection.

What is the license file extension?

LICENSE.txt is considered a type of Plain Text file. It is most-commonly used in Adobe Photoshop Elements 2020 developed by Adobe Systems Incorporated. It uses the TXT file extension and is considered a Text (Plain Text) file. The first release of LICENSE.txt for the Windows 8.1 platform was on 10/18/2013 for Windows 8.1.


Video Answer


2 Answers

Add extractComments: false to webpack.config.js


const TerserPlugin = require('terser-webpack-plugin');
.
.
.
module.exports = {
.
.
.
  optimization: {
    minimizer: [new TerserPlugin({
      extractComments: false,
    })],
  },
.
.
.
};
like image 177
Mohammad Dayyan Avatar answered Oct 23 '22 18:10

Mohammad Dayyan


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

like image 27
Sámal Rasmussen Avatar answered Oct 23 '22 17:10

Sámal Rasmussen