question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

License files being generated even with extractComments = false

See original GitHub issue
  • Laravel Mix Version: 6.0.6

Description:

I’m getting app.js.LICENSE.txt and vendor.js.LICENSE.txt files even though I’ve set the terser plugin option extractComments to false

Steps To Reproduce:

npm run watch

My config:

/* jshint node: true */
const mix = require('laravel-mix')
const path = require('path')

/** Mix Options **/
mix.options({
  terser: {
    extractComments: false,
  }
})

/**
 * Frontier Assets
 */
mix
  .js('resources/js/app.js', 'public/js')
  .vue({ version: 2 })
  .postCss('resources/css/app.css', 'public/css')
  .copy('resources/img/', 'public/img/')
  .extract()

// Add version in production build
if (mix.inProduction()) {
  mix.version()
}

/**
 * Custom webpack config.
 */
mix.webpackConfig(require('./webpack.config'))

Contents of webpack.config.js:

/**
 * The Path module.
 */
const path = require('path');

/**
 * Custom Webpack config.
 *
 * Described here, in the separate file, for the IDE support.
 *
 * @see https://gist.github.com/nachodd/4e120492a5ddd56360e8cff9595753ae
 */
module.exports = {
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'resources/js'),
      '@css': path.resolve(__dirname, 'resources/css'),
    }
  },
  optimization: {
    minimize: true,
  }
};

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

4reactions
ghostcommented, Jan 12, 2021

This should work for what you want to do:

mix.options({
    terser: {
        extractComments: (astNode, comment) => false,
        terserOptions: {
            format: {
                comments: false,
            }
        }
    }
});
1reaction
saas786commented, Feb 3, 2021

@bcorcoran

try this:

mix.options({
	terser: {
		extractComments: false,
		terserOptions: {
			output: {
				comments: false,
			},
		},
	},
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

License files being generated even with extractComments ...
Laravel Mix Version: 6.0.6 Description: I'm getting app.js. ... License files being generated even with extractComments = false #2738.
Read more >
License files being generated even with extractComments ...
License files being generated even with extractComments = false. ... LICENSE.txt files even though I've set the terser plugin option ...
Read more >
Webpack - omit creation of LICENSE.txt files - Stack Overflow
Note: extractComments: false will omit the creation of a separate LICENSE file and terserOptions.format.comments: false will also remove the ...
Read more >
Stop Mix from generating license file - Laracasts
Mix recently started generating a license file called /js/app.js.LICENSE.txt. ... mix.options({ terser: { extractComments: false, } });.
Read more >
TerserWebpackPlugin | webpack
This plugin uses terser to minify/minimize your JavaScript. Getting Started. Webpack v5 comes with the latest terser-webpack-plugin out of the box. If you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found