Skip to content

Commit e1f9a48

Browse files
committed
refactor to run babelLoader + tsLoader for specific travis job
1 parent 686ba80 commit e1f9a48

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

webpack.config.js

+15-9
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ const USE_HOT_MODULE_RELOAD =
3333
const NO_DEV_SERVER = env.NO_DEV_SERVER;
3434
const IS_CI = !!env.CI || !!env.TRAVIS;
3535

36+
// We only use ts-loader directly in CI for a specific job
37+
const USE_TS_LOADER = env.TEST_SUITE === 'js-build';
38+
3639
// Deploy previews are built using netlify. We can check if we're in netlifys
3740
// build process by checking the existence of the PULL_REQUEST env var.
3841
//
@@ -185,13 +188,13 @@ const cacheGroups = {
185188
};
186189

187190
const babelOptions = {...babelConfig, cacheDirectory: true};
188-
const babelLoaderConfig = {loader: 'babel-loader', options: babelOptions};
191+
const babelLoaderConfig = {
192+
loader: 'babel-loader',
193+
options: babelOptions,
194+
};
189195

190196
const tsLoaderConfig = {
191197
loader: 'ts-loader',
192-
options: {
193-
transpileOnly: false,
194-
},
195198
};
196199

197200
/**
@@ -224,16 +227,19 @@ let appConfig = {
224227
test: /\.jsx?$/,
225228
include: [staticPrefix],
226229
exclude: /(vendor|node_modules|dist)/,
227-
use: {
228-
loader: 'babel-loader',
229-
options: babelOptions,
230-
},
230+
use: babelLoaderConfig,
231231
},
232232
{
233233
test: /\.tsx?$/,
234234
include: [staticPrefix],
235235
exclude: /(vendor|node_modules|dist)/,
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,
237243
},
238244
{
239245
test: /\.po$/,

0 commit comments

Comments
 (0)