2018-09-09 17:22:44 -04:00
|
|
|
module.exports = {
|
2019-08-09 10:44:11 -04:00
|
|
|
plugins: ['typescript'],
|
2018-09-09 17:22:44 -04:00
|
|
|
modify: (config, { target, dev }, webpack) => {
|
|
|
|
// load webfonts
|
|
|
|
rules = config.module.rules || [];
|
|
|
|
rules.push({
|
|
|
|
test: /\.(eot|svg|ttf|woff|woff2)$/,
|
|
|
|
loader: 'file-loader?name=public/fonts/[name].[ext]'
|
|
|
|
})
|
|
|
|
config.module.rules = rules;
|
|
|
|
|
2019-11-05 15:13:10 -05:00
|
|
|
// find module rule that runs ts-loader for TS(X) files
|
|
|
|
const tsRule = config.module.rules.find(r =>
|
|
|
|
new RegExp(r.test).test('test.tsx') && Array.isArray(r.use) && r.use.some(u => u.loader.includes('ts-loader')));
|
|
|
|
|
|
|
|
// run babel-loader before ts-loader to generate propTypes
|
|
|
|
tsRule.use.push({
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
babelrc: true
|
|
|
|
}
|
|
|
|
})
|
2018-09-09 17:22:44 -04:00
|
|
|
return config;
|
|
|
|
},
|
|
|
|
};
|