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.
Merges [43931] and [43932] to trunk.
See #45201.

git-svn-id: https://develop.svn.wordpress.org/trunk@44282 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2018-12-18 03:13:58 +00:00
parent dd9db2bf0d
commit 62a5cd343c
2 changed files with 14 additions and 1 deletions

View File

@ -105,7 +105,11 @@ module.exports = function(grunt) {
clean: {
plugins: [BUILD_DIR + 'wp-content/plugins'],
themes: [BUILD_DIR + 'wp-content/themes'],
all: cleanFiles,
all: [
cleanFiles,
SOURCE_DIR + 'wp-includes/js/dist',
SOURCE_DIR + 'wp-includes/css/dist'
],
js: [BUILD_DIR + 'wp-admin/js/', BUILD_DIR + 'wp-includes/js/'],
dynamic: {
dot: true,
@ -138,6 +142,7 @@ module.exports = function(grunt) {
'!js/**', // JavaScript is extracted into separate copy tasks.
'!.{svn,git}', // Exclude version control folders.
'!wp-includes/version.php', // Exclude version.php
'!**/*.map', // The build doesn't need .map files.
'!index.php', '!wp-admin/index.php',
'!_index.php', '!wp-admin/_index.php'
] ),

View File

@ -268,6 +268,14 @@ module.exports = function( env = { environment: 'production', watch: false, forc
config.devtool = process.env.SOURCEMAP || 'source-map';
}
if ( env.forceBuildTarget ) {
delete config.devtool;
config.mode = 'production';
config.optimization = {
minimize: false
};
}
if ( config.mode === 'development' ) {
config.plugins.push( new LiveReloadPlugin( { port: process.env.WORDPRESS_LIVE_RELOAD_PORT || 35729 } ) );
}