File tree 3 files changed +20
-4
lines changed
3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const path = require('path');
13
13
const webpack = require ( 'webpack' ) ;
14
14
const HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
15
15
const CaseSensitivePathsPlugin = require ( 'case-sensitive-paths-webpack-plugin' ) ;
16
+ const ForkTsCheckerWebpackPlugin = require ( 'fork-ts-checker-webpack-plugin' ) ;
16
17
const InterpolateHtmlPlugin = require ( 'react-dev-utils/InterpolateHtmlPlugin' ) ;
17
18
const WatchMissingNodeModulesPlugin = require ( 'react-dev-utils/WatchMissingNodeModulesPlugin' ) ;
18
19
const eslintFormatter = require ( 'react-dev-utils/eslintFormatter' ) ;
@@ -405,7 +406,13 @@ module.exports = {
405
406
fileName : 'asset-manifest.json' ,
406
407
publicPath : publicPath ,
407
408
} ) ,
408
- ] ,
409
+ // TypeScript type checking
410
+ paths . isTypeScript &&
411
+ new ForkTsCheckerWebpackPlugin ( {
412
+ async : false ,
413
+ watch : paths . appSrc ,
414
+ } ) ,
415
+ ] . filter ( Boolean ) ,
409
416
410
417
// Some libraries import Node modules but don't use them in the browser.
411
418
// Tell Webpack to provide empty mocks for them so importing them works.
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const path = require('path');
13
13
const webpack = require ( 'webpack' ) ;
14
14
const HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
15
15
const UglifyJsPlugin = require ( 'uglifyjs-webpack-plugin' ) ;
16
+ const ForkTsCheckerWebpackPlugin = require ( 'fork-ts-checker-webpack-plugin' ) ;
16
17
const MiniCssExtractPlugin = require ( 'mini-css-extract-plugin' ) ;
17
18
const OptimizeCSSAssetsPlugin = require ( 'optimize-css-assets-webpack-plugin' ) ;
18
19
const ManifestPlugin = require ( 'webpack-manifest-plugin' ) ;
@@ -477,7 +478,13 @@ module.exports = {
477
478
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
478
479
// You can remove this if you don't use Moment.js:
479
480
new webpack . IgnorePlugin ( / ^ \. \/ l o c a l e $ / , / m o m e n t $ / ) ,
480
- ] ,
481
+ // TypeScript type checking
482
+ paths . isTypeScript &&
483
+ new ForkTsCheckerWebpackPlugin ( {
484
+ async : false ,
485
+ watch : paths . appSrc ,
486
+ } ) ,
487
+ ] . filter ( Boolean ) ,
481
488
// Some libraries import Node modules but don't use them in the browser.
482
489
// Tell Webpack to provide empty mocks for them so importing them works.
483
490
node : {
Original file line number Diff line number Diff line change 44
44
"eslint-plugin-jsx-a11y" : " 6.0.3" ,
45
45
"eslint-plugin-react" : " 7.8.2" ,
46
46
"file-loader" : " 1.1.11" ,
47
+ "fork-ts-checker-webpack-plugin" : " ^0.4.6" ,
47
48
"fs-extra" : " 5.0.0" ,
48
49
"graphql" : " 0.13.2" ,
49
50
"graphql-tag" : " 2.9.2" ,
50
51
"html-webpack-plugin" : " 3.2.0" ,
51
52
"identity-obj-proxy" : " 3.0.0" ,
52
- "loader-utils" : " ^1.1.0" ,
53
53
"jest" : " 22.4.3" ,
54
+ "loader-utils" : " ^1.1.0" ,
54
55
"mini-css-extract-plugin" : " ^0.4.0" ,
55
56
"object-assign" : " 4.1.1" ,
56
- "postcss-flexbugs-fixes" : " 3.3.1" ,
57
57
"optimize-css-assets-webpack-plugin" : " ^4.0.1" ,
58
+ "postcss-flexbugs-fixes" : " 3.3.1" ,
58
59
"postcss-loader" : " 2.1.5" ,
59
60
"promise" : " 8.0.1" ,
60
61
"raf" : " 3.4.0" ,
65
66
"svgr" : " 1.9.2" ,
66
67
"sw-precache-webpack-plugin" : " 0.11.5" ,
67
68
"thread-loader" : " 1.1.5" ,
69
+ "typescript" : " ^3" ,
68
70
"uglifyjs-webpack-plugin" : " 1.2.5" ,
69
71
"url-loader" : " 1.0.1" ,
70
72
"webpack" : " 4.8.3" ,
You can’t perform that action at this time.
0 commit comments