Recently, I set out to compare the compiled output code between these two configurations.
ts-loader
{
test: /\.tsx?$/,
use: 'ts-loader',
}
babel-loader
use: {
loader: 'babel-loader',
options: {
presets:
[
"@babel/preset-react",
"@babel/preset-typescript",
]
}
}
- Interestingly, the compiling times for babel-loader were consistently lower than those for ts-loader.
- On top of that, ts-loader appears to be utilizing babel under its hood, as indicated by its dependencies.
- Furthermore, babel-loader offers the advantage of using cache with cacheDirectory.
Inquiries
- Is there a method to implement caching in ts-loader similar to how cacheDirectory operates in babel?
- Are there any additional benefits to using ts-loader instead of babel-loader?