@@ -62,14 +62,26 @@ module.exports = function(webpackEnv) {
6262 const isEnvDevelopment = webpackEnv === 'development' ;
6363 const isEnvProduction = webpackEnv === 'production' ;
6464
65- const workspacesMainFields = [ workspacesConfig . packageEntry , 'browser' , 'module' , 'main' ] ;
65+ const workspacesMainFields = [
66+ workspacesConfig . packageEntry ,
67+ 'browser' ,
68+ 'module' ,
69+ 'main' ,
70+ ] ;
6671 const mainFields =
6772 isEnvDevelopment && workspacesConfig . development
6873 ? workspacesMainFields
6974 : isEnvProduction && workspacesConfig . production
7075 ? workspacesMainFields
7176 : undefined ;
7277
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+ 7385 // Webpack uses `publicPath` to determine where the app is being served from.
7486 // It requires a trailing slash, or the file assets will get an incorrect path.
7587 // In development, we always serve from the root. This makes config easier.
@@ -342,11 +354,13 @@ module.exports = function(webpackEnv) {
342354 loader : require . resolve ( 'eslint-loader' ) ,
343355 } ,
344356 ] ,
345- include : isEnvDevelopment && workspacesConfig . development
346- ? [ paths . appSrc , workspacesConfig . paths ]
347- : isEnvProduction && workspacesConfig . production
348- ? [ paths . appSrc , workspacesConfig . paths ]
349- : paths . appSrc ,
357+ include : includePaths ,
358+ // Don't lint typescript files outside the main package because it has problems with some syntax rules, e.g. abstract
359+ exclude : useTypeScript
360+ ? file =>
361+ / \. t s x ? / . test ( path . extname ( file ) ) &&
362+ ! file . startsWith ( paths . appSrc )
363+ : undefined ,
350364 } ,
351365 {
352366 // "oneOf" will traverse all following loaders until one will
@@ -368,12 +382,7 @@ module.exports = function(webpackEnv) {
368382 // The preset includes JSX, Flow, TypeScript, and some ESnext features.
369383 {
370384 test : / \. ( j s | m j s | j s x | t s | t s x ) $ / ,
371- include :
372- isEnvDevelopment && workspacesConfig . development
373- ? [ paths . appSrc , workspacesConfig . paths ]
374- : isEnvProduction && workspacesConfig . production
375- ? [ paths . appSrc , workspacesConfig . paths ]
376- : paths . appSrc ,
385+ include : includePaths ,
377386 loader : require . resolve ( 'babel-loader' ) ,
378387 options : {
379388 customize : require . resolve (
@@ -656,6 +665,10 @@ module.exports = function(webpackEnv) {
656665 typescript : resolve . sync ( 'typescript' , {
657666 basedir : paths . appNodeModules ,
658667 } ) ,
668+ compilerOptions : {
669+ skipLibCheck : true ,
670+ suppressOutputPathCheck : true ,
671+ } ,
659672 async : isEnvDevelopment ,
660673 useTypescriptIncrementalApi : true ,
661674 checkSyntacticErrors : true ,
@@ -667,7 +680,7 @@ module.exports = function(webpackEnv) {
667680 '!**/src/setupProxy.*' ,
668681 '!**/src/setupTests.*' ,
669682 ] ,
670- watch : paths . appSrc ,
683+ watch : includePaths ,
671684 silent : true ,
672685 // The formatter is invoked directly in WebpackDevServerUtils during development
673686 formatter : isEnvProduction ? typescriptFormatter : undefined ,
0 commit comments