[英]Specify path to tsconfig.json
I am using webpack with awesome-typescript-loader in an environment with multiple tsconfig.json files. 我在具有多个tsconfig.json文件的环境中使用带有awesome-typescript-loader的webpack。 Is there a way in webpack to specify the path of the desired tsconfig.json file?
在webpack中有一种方法可以指定所需的tsconfig.json文件的路径吗?
loaders: 装载机:
{
test: /\.ts$/,
loaders: ['awesome-typescript-loader', 'angular2-template-loader'],
exclude: [/\.(spec|e2e)\.ts$/]
}
loaders: ['awesome-typescript-loader?tsconfig=/path/to/tsconfig.json', 'angular2-template-loader'],
Currently, loaders are a list of objects. 目前,加载器是一个对象列表。 Also, you can provide
query
parameters in a cleaner way. 此外,您可以以更干净的方式提供
query
参数。 Instead of: 代替:
loader: 'awesome-typescript-loader?configFileName=...'
you can have: 你可以有:
// Assuming your typescript stuff is in ./src/components:
loaders: [
{
test: /src\/components\/.*\.tsx?$/,
exclude: /node_modules/,
loader: 'awesome-typescript-loader',
query: {
// Use this to point to your tsconfig.json.
configFileName: './src/components/tsconfig.json'
}
},
{
// Another loader...
}
]
Update 更新
I believe loaders
are now called rules
. 我相信
loaders
现在被称为rules
。 So instead of: 所以代替:
loaders: [
...
]
You would use: 你会用:
rules: [
...
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.