From 5b39ce2822597fd8217c91c46fd6f80dea08f85a Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 29 Jul 2020 17:31:01 -0300 Subject: [PATCH] Improve source maps (#9101) Our source maps were being corrupted during minification, because the `gulp-terser-js` plugin we were using didn't account for the existence of sourcemaps in the input. A configuration option to allow the input of sourcemaps was added in v5.2.0. The plugin has been updated, and we now use this option. Previously the generated sourcemaps had an invalid entry in the "sources" array, with the filename of the bundle itself. This was not a real source. After this change, this invalid source is no longer present. --- development/build/scripts.js | 3 +++ package.json | 2 +- yarn.lock | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/development/build/scripts.js b/development/build/scripts.js index 8a6b49111..04f21aa76 100644 --- a/development/build/scripts.js +++ b/development/build/scripts.js @@ -206,6 +206,9 @@ function createScriptTasks ({ browserPlatforms, livereload }) { mangle: { reserved: [ 'MetamaskInpageProvider' ], }, + sourceMap: { + content: true, + }, })) } diff --git a/package.json b/package.json index f26a98e85..78e66b49b 100644 --- a/package.json +++ b/package.json @@ -236,7 +236,7 @@ "gulp-sass": "^4.0.0", "gulp-sourcemaps": "^2.6.0", "gulp-stylelint": "^13.0.0", - "gulp-terser-js": "^5.0.0", + "gulp-terser-js": "^5.2.2", "gulp-watch": "^5.0.1", "gulp-zip": "^4.0.0", "jsdom": "^11.2.0", diff --git a/yarn.lock b/yarn.lock index eae41c1f7..f1ffc3d0c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12979,14 +12979,14 @@ gulp-stylelint@^13.0.0: strip-ansi "^6.0.0" through2 "^3.0.1" -gulp-terser-js@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/gulp-terser-js/-/gulp-terser-js-5.0.0.tgz#b570bb14e9c836aab78d633411073af0df8ca514" - integrity sha512-X5bduLqvRdX1RwUJmdm1J+HZu85gfIKkmDK95J6AAfXd4W/oYANt82gmIMZfhUGEmLm6e6xtKGsfTW6c0BRWnQ== +gulp-terser-js@^5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/gulp-terser-js/-/gulp-terser-js-5.2.2.tgz#3d93db9b2b83f35dfcc5b209af6b1762756eb6a3" + integrity sha512-4ull0HzTWeWjRPiGmAFmdhRcEDOG+r7aXivNHOBQzElLzMaeVKQwmCPDi2juBzUUkjAkPkKb1jHVoJN/PKTvcA== dependencies: - object-assign "^4.1.1" plugin-error "^1.0.1" - terser "^4.1.4" + source-map "^0.7.3" + terser "^4.6.12" through2 "^3.0.1" vinyl-sourcemaps-apply "^0.2.1" @@ -25703,10 +25703,10 @@ terser@^4.1.2, terser@^4.4.3: source-map "~0.6.1" source-map-support "~0.5.12" -terser@^4.1.4: - version "4.3.1" - resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.1.tgz#09820bcb3398299c4b48d9a86aefc65127d0ed65" - integrity sha512-pnzH6dnFEsR2aa2SJaKb1uSCl3QmIsJ8dEkj0Fky+2AwMMcC9doMqLOQIH6wVTEKaVfKVvLSk5qxPBEZT9mywg== +terser@^4.6.12: + version "4.8.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17" + integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw== dependencies: commander "^2.20.0" source-map "~0.6.1"