diff --git a/packages/react-scripts/backpack-addons/ssr/customWebpackUtils.js b/packages/react-scripts/backpack-addons/ssr/customWebpackUtils.js index df6af5498a3..0321ceb096d 100644 --- a/packages/react-scripts/backpack-addons/ssr/customWebpackUtils.js +++ b/packages/react-scripts/backpack-addons/ssr/customWebpackUtils.js @@ -78,13 +78,22 @@ function createCustomCompiler( forkTsCheckerWebpackPlugin .getCompilerHooks(compiler) - .receive.tap('afterTypeScriptCheck', (diagnostics, lints) => { - const allMsgs = [...diagnostics, ...lints]; + .waiting.tap('awaitingTypeScriptCheck', () => { + console.log( + chalk.yellow( + 'Files successfully emitted, waiting for typecheck results...' + ) + ); + }); + + forkTsCheckerWebpackPlugin + .getCompilerHooks(compiler) + .issues.tap('afterTypeScriptCheck', issues => { const format = message => `${message.file}\n${message}`; tsMessagesResolver({ - errors: allMsgs.filter(msg => msg.severity === 'error').map(format), - warnings: allMsgs + errors: issues.filter(msg => msg.severity === 'error').map(format), + warnings: issues .filter(msg => msg.severity === 'warning') .map(format), }); diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index a0a373e2ccb..104e59c5dac 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -376,6 +376,14 @@ module.exports = function (webpackEnv) { exclude: /@babel(?:\/|\\{1,2})runtime/, test: /\.(js|mjs|cjs|jsx|ts|tsx|css)$/, loader: require.resolve('source-map-loader'), + options: { + filterSourceMappingUrl: (url, resourcePath) => { + // We need to see warnings about incorrect sourcemaps only for local files or in debug mode + // Upstream issue in CRA, still not fixed + //https://stackoverflow.com/questions/63195843/webpack-module-warning-failed-to-parse-source-map-from-data-url + return !/.*\/node_modules\/.*/.test(resourcePath) || isDebugMode; + }, + }, }, { // "oneOf" will traverse all following loaders until one will diff --git a/packages/react-scripts/config/webpack.config.ssr.js b/packages/react-scripts/config/webpack.config.ssr.js index 1d561bd68fb..7046d2179b7 100644 --- a/packages/react-scripts/config/webpack.config.ssr.js +++ b/packages/react-scripts/config/webpack.config.ssr.js @@ -384,6 +384,14 @@ module.exports = function (webpackEnv) { exclude: /@babel(?:\/|\\{1,2})runtime/, test: /\.(js|mjs|cjs|jsx|ts|tsx|css)$/, loader: require.resolve('source-map-loader'), + options: { + filterSourceMappingUrl: (url, resourcePath) => { + // We need to see warnings about incorrect sourcemaps only for local files or in debug mode + // Upstream issue in CRA, still not fixed + //https://stackoverflow.com/questions/63195843/webpack-module-warning-failed-to-parse-source-map-from-data-url + return !/.*\/node_modules\/.*/.test(resourcePath) || isDebugMode; + }, + }, }, { // "oneOf" will traverse all following loaders until one will