@@ -14,6 +14,7 @@ const CompressionPlugin = require('compression-webpack-plugin');
14
14
const OptimizeCssAssetsPlugin = require ( 'optimize-css-assets-webpack-plugin' ) ;
15
15
const FixStyleOnlyEntriesPlugin = require ( 'webpack-fix-style-only-entries' ) ;
16
16
const CopyPlugin = require ( 'copy-webpack-plugin' ) ;
17
+ const ForkTsCheckerWebpackPlugin = require ( 'fork-ts-checker-webpack-plugin' ) ;
17
18
18
19
const babelConfig = require ( './babel.config' ) ;
19
20
@@ -30,6 +31,7 @@ const SENTRY_WEBPACK_PROXY_PORT = env.SENTRY_WEBPACK_PROXY_PORT;
30
31
const USE_HOT_MODULE_RELOAD =
31
32
! IS_PRODUCTION && SENTRY_BACKEND_PORT && SENTRY_WEBPACK_PROXY_PORT ;
32
33
const NO_DEV_SERVER = env . NO_DEV_SERVER ;
34
+ const IS_CI = ! ! env . CI || ! ! env . TRAVIS ;
33
35
34
36
// Deploy previews are built using netlify. We can check if we're in netlifys
35
37
// build process by checking the existence of the PULL_REQUEST env var.
@@ -183,6 +185,14 @@ const cacheGroups = {
183
185
} ;
184
186
185
187
const babelOptions = { ...babelConfig , cacheDirectory : true } ;
188
+ const babelLoaderConfig = {
189
+ loader : 'babel-loader' ,
190
+ options : babelOptions ,
191
+ } ;
192
+
193
+ const tsLoaderConfig = {
194
+ loader : 'ts-loader' ,
195
+ } ;
186
196
187
197
/**
188
198
* Main Webpack config for Sentry React SPA.
@@ -214,27 +224,15 @@ let appConfig = {
214
224
test : / \. j s x ? $ / ,
215
225
include : [ staticPrefix ] ,
216
226
exclude : / ( v e n d o r | n o d e _ m o d u l e s | d i s t ) / ,
217
- use : {
218
- loader : 'babel-loader' ,
219
- options : babelOptions ,
220
- } ,
227
+ use : babelLoaderConfig ,
221
228
} ,
222
229
{
223
230
test : / \. t s x ? $ / ,
224
231
include : [ staticPrefix ] ,
225
232
exclude : / ( v e n d o r | n o d e _ m o d u l e s | d i s t ) / ,
226
- use : [
227
- {
228
- loader : 'babel-loader' ,
229
- options : babelOptions ,
230
- } ,
231
- {
232
- loader : 'ts-loader' ,
233
- options : {
234
- transpileOnly : false ,
235
- } ,
236
- } ,
237
- ] ,
233
+ // Make sure we typecheck in CI, but not for local dev since that is run with
234
+ // the fork-ts plugin
235
+ use : ! IS_CI ? babelLoaderConfig : [ babelLoaderConfig , tsLoaderConfig ] ,
238
236
} ,
239
237
{
240
238
test : / \. p o $ / ,
@@ -320,6 +318,14 @@ let appConfig = {
320
318
321
319
new SentryInstrumentation ( ) ,
322
320
321
+ ...( ! IS_CI
322
+ ? [
323
+ new ForkTsCheckerWebpackPlugin ( {
324
+ tsconfig : path . resolve ( __dirname , './tsconfig.json' ) ,
325
+ } ) ,
326
+ ]
327
+ : [ ] ) ,
328
+
323
329
...localeRestrictionPlugins ,
324
330
] ,
325
331
resolve : {
0 commit comments