From 09cbb89d44773c77b9197e864bbafb80bd853098 Mon Sep 17 00:00:00 2001 From: Justin Grant Date: Wed, 9 Oct 2019 23:20:18 -0700 Subject: [PATCH] Add Babel sourcemap to resolve VSCode debugging issues (#7022) --- packages/react-scripts/config/webpack.config.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index f4391c39..6de37be2 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -489,11 +489,11 @@ module.exports = function(webpackEnv) { ] ), // @remove-on-eject-end - // If an error happens in a package, it's possible to be - // because it was compiled. Thus, we don't want the browser - // debugger to show the original code. Instead, the code - // being evaluated would be much more helpful. - sourceMaps: false, + // Babel sourcemaps are needed for debugging into node_modules + // code. Without the options below, debuggers like VSCode + // show incorrect code and set breakpoints on the wrong lines. + sourceMaps: shouldUseSourceMap, + inputSourceMap: shouldUseSourceMap, }, }, // "postcss" loader applies autoprefixer to our CSS.