From edbb865da0410182a36695160abecb35885a4f4c Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Thu, 22 Nov 2018 03:11:22 +0000 Subject: [PATCH] Build Tools: Tweak the webpack config for unminified files. [43931] unintentionally caused the unminified files to wrap the code in an `eval()` call. See #45201. git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43932 602fd350-edb4-49c9-b593-d223f7449a82 --- tools/webpack/packages.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/webpack/packages.js b/tools/webpack/packages.js index d4a3be2ef5..d2ab0d5e51 100644 --- a/tools/webpack/packages.js +++ b/tools/webpack/packages.js @@ -264,10 +264,18 @@ module.exports = function( env = { environment: 'production', watch: false, forc watch: env.watch, }; - if ( config.mode !== 'production' && ! env.forceBuildTarget ) { + if ( config.mode !== 'production' ) { 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 } ) ); }