Strip out comments from generated code

Changelog-entry: Strip out comments from generated code
Change-type: patch
This commit is contained in:
Alexis Svinartchouk 2020-05-25 13:05:50 +02:00
parent bf26d4ec95
commit 880e56e563
3 changed files with 27 additions and 1 deletions

10
npm-shrinkwrap.json generated
View File

@ -964,6 +964,16 @@
"@types/estree": "*" "@types/estree": "*"
} }
}, },
"@types/terser-webpack-plugin": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@types/terser-webpack-plugin/-/terser-webpack-plugin-2.2.0.tgz",
"integrity": "sha512-ywqEfTm7KdKoX9aYx0zYtiFU1z6IHrIYW9FJqeay2Ea58rTPML1J0hvoztGal2Jow3bkgGKcAmEZNL+8LqUVrA==",
"dev": true,
"requires": {
"@types/webpack": "*",
"terser": "^4.3.9"
}
},
"@types/tmp": { "@types/tmp": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.2.0.tgz", "resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.2.0.tgz",

View File

@ -60,6 +60,7 @@
"@types/request": "^2.48.4", "@types/request": "^2.48.4",
"@types/semver": "^7.1.0", "@types/semver": "^7.1.0",
"@types/sinon": "^9.0.0", "@types/sinon": "^9.0.0",
"@types/terser-webpack-plugin": "^2.2.0",
"@types/tmp": "^0.2.0", "@types/tmp": "^0.2.0",
"@types/webpack-node-externals": "^1.7.0", "@types/webpack-node-externals": "^1.7.0",
"bluebird": "^3.7.2", "bluebird": "^3.7.2",

View File

@ -23,6 +23,7 @@ import * as os from 'os';
import outdent from 'outdent'; import outdent from 'outdent';
import * as path from 'path'; import * as path from 'path';
import * as SimpleProgressWebpackPlugin from 'simple-progress-webpack-plugin'; import * as SimpleProgressWebpackPlugin from 'simple-progress-webpack-plugin';
import * as TerserPlugin from 'terser-webpack-plugin';
import { BannerPlugin } from 'webpack'; import { BannerPlugin } from 'webpack';
/** /**
@ -102,7 +103,21 @@ function replace(test: RegExp, ...replacements: ReplacementRule[]) {
const commonConfig = { const commonConfig = {
mode: 'production', mode: 'production',
optimization: { optimization: {
minimize: false, minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: false,
mangle: false,
output: {
beautify: true,
comments: false,
ecma: 2018,
},
},
extractComments: false,
}),
],
}, },
module: { module: {
rules: [ rules: [