Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove comments in chunk-vendors.js

a little strange question, but how to remove comments from the file chunk-vendors.js? I mean, there are automatically placed licenses and other information about plugins, including the vue, vuex, vue-router.

Is there any parameter responsible for this? I’m tired of removing these lines manually after each build

I use vue-cli

like image 929
Arch4Arts Avatar asked May 12 '20 18:05

Arch4Arts


1 Answers

Assuming Vue CLI 3 or newer, this is handled by the minimizer's (terser) output options. Specifically, set output.comments=false to exclude comments from the minified output.

Edit vue.config.js to include:

module.exports = {
  chainWebpack: config => {
    config.optimization.minimizer('terser').tap((args) => {
      args[0].terserOptions.output = {
        ...args[0].terserOptions.output,
        comments: false  // exclude all comments from output
      }
      return args
    })
  }
}
like image 186
tony19 Avatar answered Sep 24 '22 18:09

tony19