How does Webpack delete comments when exporting?

when writing Webpack applications, you want to delete comments on compiled files
but do not want to compress JS files. Previously, delete and do not compress JS files using Uglifyjs.
in Webpack4, mode is none or development seems to skip minimizer
and the configuration that looks like Uglifyjs comments: false cannot delete comments

. < hr >

in addition, Uglifyjs seems to have no way to add raw banner? Do not use / * * / to enclose

as BannerPlugin does. < hr >

tested

mode is none or development seems to skip minimizer directly

will not skip the minimizer, problem, that is, how to delete comments without compressing the file

minimizer: [
    new UglifyJsPlugin({
        uglifyOptions: ({
            compress: false
        })
    })
]

is still compressed


the final solution is actually a seemingly irrelevant setting

new UglifyJsPlugin({
    uglifyOptions: {
        mangle: false,
        output: {
            beautify: true,
        },
    }
}),

beautify is not compressed.

Menu