Skip to content

Commit a754bcf

Browse files
committed
Set up ForkTsCheckerWebpackPlugin for workspaces
1 parent 19e2490 commit a754bcf

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

packages/react-scripts/config/webpack.config.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ module.exports = function(webpackEnv) {
7575
? workspacesMainFields
7676
: undefined;
7777

78+
const includePaths =
79+
isEnvDevelopment && workspacesConfig.development
80+
? [paths.appSrc, ...workspacesConfig.paths]
81+
: isEnvProduction && workspacesConfig.production
82+
? [paths.appSrc, ...workspacesConfig.paths]
83+
: paths.appSrc;
84+
7885
// Webpack uses `publicPath` to determine where the app is being served from.
7986
// It requires a trailing slash, or the file assets will get an incorrect path.
8087
// In development, we always serve from the root. This makes config easier.
@@ -347,11 +354,7 @@ module.exports = function(webpackEnv) {
347354
loader: require.resolve('eslint-loader'),
348355
},
349356
],
350-
include: isEnvDevelopment && workspacesConfig.development
351-
? [paths.appSrc, workspacesConfig.paths]
352-
: isEnvProduction && workspacesConfig.production
353-
? [paths.appSrc, workspacesConfig.paths]
354-
: paths.appSrc,
357+
include: includePaths,
355358
},
356359
{
357360
// "oneOf" will traverse all following loaders until one will
@@ -373,12 +376,7 @@ module.exports = function(webpackEnv) {
373376
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
374377
{
375378
test: /\.(js|mjs|jsx|ts|tsx)$/,
376-
include:
377-
isEnvDevelopment && workspacesConfig.development
378-
? [paths.appSrc, workspacesConfig.paths]
379-
: isEnvProduction && workspacesConfig.production
380-
? [paths.appSrc, workspacesConfig.paths]
381-
: paths.appSrc,
379+
include: includePaths,
382380
loader: require.resolve('babel-loader'),
383381
options: {
384382
customize: require.resolve(
@@ -661,6 +659,10 @@ module.exports = function(webpackEnv) {
661659
typescript: resolve.sync('typescript', {
662660
basedir: paths.appNodeModules,
663661
}),
662+
compilerOptions: {
663+
skipLibCheck: true,
664+
suppressOutputPathCheck: true,
665+
},
664666
async: isEnvDevelopment,
665667
useTypescriptIncrementalApi: true,
666668
checkSyntacticErrors: true,
@@ -672,7 +674,7 @@ module.exports = function(webpackEnv) {
672674
'!**/src/setupProxy.*',
673675
'!**/src/setupTests.*',
674676
],
675-
watch: paths.appSrc,
677+
watch: includePaths,
676678
silent: true,
677679
// The formatter is invoked directly in WebpackDevServerUtils during development
678680
formatter: isEnvProduction ? typescriptFormatter : undefined,

0 commit comments

Comments
 (0)