mirror of
https://github.com/jquery/jquery.git
synced 2024-12-09 08:04:24 +00:00
27303c6be0
UglifyJS is ES5-only, while Terser supports newer ECMAScript versions. jQuery is authored in ES5 but jQuery 4.x will also have an ESM build that cannot be minified using UglifyJS directly. We could strip the `export` statement, minify via UglifyJS and re-add one but that increases complexity & may not fully play nice with source maps. On the other hand, switching to Terser increases the minfied size by just 324 bytes and the minified gzipped one by just 70 bytes. Such differences largely disappear among bigger size gains from the `3.x-stable` line - around 2.7 KB minified gzipped as of now. Closes gh-5258
18 lines
574 B
JavaScript
18 lines
574 B
JavaScript
"use strict";
|
|
|
|
var fs = require( "fs" );
|
|
|
|
module.exports = function( grunt ) {
|
|
var config = grunt.config( "terser.all.files" );
|
|
grunt.registerTask( "remove_map_comment", function() {
|
|
var minLoc = grunt.config.process( Object.keys( config )[ 0 ] );
|
|
|
|
// Remove the source map comment; it causes way too many problems.
|
|
// The map file is still generated for manual associations
|
|
// https://github.com/jquery/jquery/issues/1707
|
|
var text = fs.readFileSync( minLoc, "utf8" )
|
|
.replace( /\/\/# sourceMappingURL=\S+/, "" );
|
|
fs.writeFileSync( minLoc, text );
|
|
} );
|
|
};
|