Skip to content

Instantly share code, notes, and snippets.

@sibelius
Created July 22, 2019 00:51
Show Gist options
  • Save sibelius/594a6b64656047e5f22f1363cd41aa87 to your computer and use it in GitHub Desktop.
Save sibelius/594a6b64656047e5f22f1363cd41aa87 to your computer and use it in GitHub Desktop.
react-scripts patch-package to avoid type checking on CRA
diff --git a/node_modules/react-scripts/config/webpack.config.js b/node_modules/react-scripts/config/webpack.config.js
index 8f70442..dfd86d8 100644
--- a/node_modules/react-scripts/config/webpack.config.js
+++ b/node_modules/react-scripts/config/webpack.config.js
@@ -47,6 +47,10 @@ const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
// Check if TypeScript is setup
const useTypeScript = fs.existsSync(paths.appTsConfig);
+// Skip TypeScript type checking
+const typeCheckTypeScript =
+ useTypeScript && !(process.env.SKIP_TYPE_CHECK === 'true');
+
// style files regexes
const cssRegex = /\.css$/;
const cssModuleRegex = /\.module\.css$/;
@@ -629,7 +633,7 @@ module.exports = function(webpackEnv) {
],
}),
// TypeScript type checking
- useTypeScript &&
+ typeCheckTypeScript &&
new ForkTsCheckerWebpackPlugin({
typescript: resolve.sync('typescript', {
basedir: paths.appNodeModules,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment