Reputation: 39278
I am using webpack with awesome-typescript-loader in an environment with multiple tsconfig.json files. Is there a way in webpack to specify the path of the desired tsconfig.json file?
loaders:
{
test: /\.ts$/,
loaders: ['awesome-typescript-loader', 'angular2-template-loader'],
exclude: [/\.(spec|e2e)\.ts$/]
}
Upvotes: 9
Views: 8535
Reputation: 2513
Currently, loaders are a list of objects. Also, you can provide query
parameters in a cleaner way. 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
. So instead of:
loaders: [
...
]
You would use:
rules: [
...
]
Upvotes: 13
Reputation: 683
loaders: ['awesome-typescript-loader?tsconfig=/path/to/tsconfig.json', 'angular2-template-loader'],
Upvotes: 15