From 2a0319b577cb04d6512d3e590e6bdd9c5259349c Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Thu, 22 Nov 2018 02:04:51 +0000 Subject: [PATCH] Build Tools: Don't include `.map` files in the build. These files are fairly large, and while they're useful in development, they're not needed in the final build. Props pento, mcsf. See #45201. git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43931 602fd350-edb4-49c9-b593-d223f7449a82 --- Gruntfile.js | 9 +++++++-- tools/webpack/packages.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 803ded4c5c..01a4eefa1f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -71,7 +71,11 @@ module.exports = function(grunt) { } }, clean: { - all: [BUILD_DIR], + all: [ + BUILD_DIR, + SOURCE_DIR + 'wp-includes/js/dist', + SOURCE_DIR + 'wp-includes/css/dist' + ], dynamic: { dot: true, expand: true, @@ -98,7 +102,8 @@ module.exports = function(grunt) { '!wp-includes/js/jquery/jquery.masonry.js', '!wp-includes/js/jquery/ui/*.js', '!wp-includes/js/tinymce/tinymce.js', - '!wp-includes/version.php' // Exclude version.php + '!wp-includes/version.php', // Exclude version.php + '!**/*.map' // The build doesn't need .map files. ], dest: BUILD_DIR }, diff --git a/tools/webpack/packages.js b/tools/webpack/packages.js index 76dfcce9bd..d4a3be2ef5 100644 --- a/tools/webpack/packages.js +++ b/tools/webpack/packages.js @@ -264,7 +264,7 @@ module.exports = function( env = { environment: 'production', watch: false, forc watch: env.watch, }; - if ( config.mode !== 'production' ) { + if ( config.mode !== 'production' && ! env.forceBuildTarget ) { config.devtool = process.env.SOURCEMAP || 'source-map'; }