Problem/Motivation
There are several previous issues discussing this, but all several years old and mostly abandoned because we didn't have either a JavaScript build step or #1014086: Stampedes and cold cache performance issues with css/js aggregation in core. Should be added as related issues.
Postponed on #2258313: Implement JS Web License Labels to allow for JS minification which we need to fulfil GPL licensing requirements.
CSS minification has very different requirements and is discussed in #3302612: Consider adopting a third party CSS minification library.
There are broadly two approaches we could take:
1. Adopt a PHP JavaScript minifier/uglifier, and then use this to process aggregates. The disadvantages are more CPU/time building aggregates, and PHP not being the best language to process JavaScript.
2. Uglify/minify JavaScript assets via the build step to .min.js files (which get committed to the git repo), and then use those when building aggregates.
On-the-fly minification with JavaScript isn't doable without introducing a node dependency to core. Having some minification in core is a lot better than none, even if better theoretical methods exist, because only a small fraction of sites will install contrib modules (let alone server-side dependencies) purely to improve front-end performance.