From a09836f0a59ecf251f4d220692056a1af73df44f Mon Sep 17 00:00:00 2001 From: Justin Grant Date: Wed, 8 May 2019 16:18:01 -0700 Subject: [PATCH] Add babel sourcemap options (fix VSCode debugging) --- 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 dad50a319d4..99799a76eea 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -470,11 +470,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.