【发布时间】:2018-04-04 10:17:43
【问题描述】:
我希望在 Babel 中使用 typescript 加载器,我看到了:
https://github.com/TypeStrong/ts-loader
module.exports = {
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true
}
}
]
}
]
}
}
为什么使用module.rules 而不是module.loaders?例如,我本来希望看到这个:
module.exports = {
module: {
loaders: [ // loaders instead of rules
{
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true
}
}
]
}
]
}
}
有什么区别?
【问题讨论】:
标签: typescript webpack webpack.config.js