Add TypeScript support for React components

This commit is contained in:
MrTimscampi 2021-06-11 14:49:57 +02:00
parent 0dde17fbd7
commit 4d23e79f65
16 changed files with 810 additions and 107 deletions

View file

@ -24,6 +24,7 @@ module.exports = {
context: path.resolve(__dirname, 'src'),
target: 'browserslist',
resolve: {
extensions: ['.tsx', '.ts', '.js'],
modules: [
path.resolve(__dirname, 'node_modules')
]
@ -87,12 +88,19 @@ module.exports = {
}
},
{
test: /\.js$/,
test: /\.(js|jsx)$/,
exclude: /node_modules[\\/](?!@uupaa[\\/]dynamic-import-polyfill|date-fns|epubjs|flv.js|libarchive.js)/,
use: [{
loader: 'babel-loader'
}]
},
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: [{
loader: 'ts-loader'
}]
},
/* modules that Babel breaks when transforming to ESM */
{
test: /node_modules[\\/](pdfjs-dist|xmldom)[\\/].*\.js$/,