From 9b0b7b9b1c478b52b919c631d47e668856d1fdd8 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Tue, 5 Jan 2021 15:14:17 +0100 Subject: Polygerrit: Wipe out license headers in minified gr-app.js By default terser keeps all licensing comments as many licenses require you to keep a copy of the license in redistributed source: [1] --comments [filter] Preserve copyright comments in the output. By default this works like Google Closure, keeping JSDoc-style comments that contain "@license" or "@preserve". You can optionally pass one of the following arguments to this flag: - "all" to keep all comments - `false` to omit comments in the output - a valid JS RegExp like `/foo/` or `/^!/` to keep only matching comments. Note that currently not *all* comments can be kept when compression is on, because of dead code removal or cascading statements into sequences. In minified gr-app.js version we don't need to preserve license information and can remove it. This saves ca. 300KB in gr-app.js size. [1] https://github.com/terser/terser Bug: Issue 13870 Change-Id: I2736879d252994200ad2f52e414e224ebe56b65d --- polygerrit-ui/app/rollup.config.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/polygerrit-ui/app/rollup.config.js b/polygerrit-ui/app/rollup.config.js index d83f24fb25..cfc8c015fd 100644 --- a/polygerrit-ui/app/rollup.config.js +++ b/polygerrit-ui/app/rollup.config.js @@ -75,7 +75,13 @@ export default { output: { format: 'iife', compact: true, - plugins: [terser()] + plugins: [ + terser({ + output: { + comments: false + } + }) + ] }, //Context must be set to window to correctly processing global variables context: 'window', -- cgit v1.2.3