@@ -33,6 +33,9 @@ const USE_HOT_MODULE_RELOAD =
33
33
const NO_DEV_SERVER = env . NO_DEV_SERVER ;
34
34
const IS_CI = ! ! env . CI || ! ! env . TRAVIS ;
35
35
36
+ // We only use ts-loader directly in CI for a specific job
37
+ const USE_TS_LOADER = env . TEST_SUITE === 'js-build' ;
38
+
36
39
// Deploy previews are built using netlify. We can check if we're in netlifys
37
40
// build process by checking the existence of the PULL_REQUEST env var.
38
41
//
@@ -185,13 +188,13 @@ const cacheGroups = {
185
188
} ;
186
189
187
190
const babelOptions = { ...babelConfig , cacheDirectory : true } ;
188
- const babelLoaderConfig = { loader : 'babel-loader' , options : babelOptions } ;
191
+ const babelLoaderConfig = {
192
+ loader : 'babel-loader' ,
193
+ options : babelOptions ,
194
+ } ;
189
195
190
196
const tsLoaderConfig = {
191
197
loader : 'ts-loader' ,
192
- options : {
193
- transpileOnly : false ,
194
- } ,
195
198
} ;
196
199
197
200
/**
@@ -224,16 +227,19 @@ let appConfig = {
224
227
test : / \. j s x ? $ / ,
225
228
include : [ staticPrefix ] ,
226
229
exclude : / ( v e n d o r | n o d e _ m o d u l e s | d i s t ) / ,
227
- use : {
228
- loader : 'babel-loader' ,
229
- options : babelOptions ,
230
- } ,
230
+ use : babelLoaderConfig ,
231
231
} ,
232
232
{
233
233
test : / \. t s x ? $ / ,
234
234
include : [ staticPrefix ] ,
235
235
exclude : / ( v e n d o r | n o d e _ m o d u l e s | d i s t ) / ,
236
- use : [ ! IS_CI ? babelLoaderConfig : tsLoaderConfig ] ,
236
+
237
+ // Note there is an emotion bug if we run babel-loader in conjunction with ts-loader
238
+ // See https://github.com/emotion-js/emotion/issues/1748
239
+ //
240
+ // However, we don't want to lose typechecking in CI, so we have a CI task
241
+ // that will run explicitly ts-loader
242
+ use : USE_TS_LOADER ? [ babelLoaderConfig , tsLoaderConfig ] : babelLoaderConfig ,
237
243
} ,
238
244
{
239
245
test : / \. p o $ / ,
0 commit comments