I want to add async-catch-loader
to auto inject try catch
for my code. And my project was based on Vue CLI and TypeScript. So i need use webpack-chain to change the ts
rule of webpack, which as show the below:
{
test: /\.m?jsx?$/,
enforce: 'pre',
use: [
{
loader: '/Users/wjc/Documents/company/project/demos/async-test/node_modules/cache-loader/dist/cjs.js',
options: {
cacheDirectory: '/Users/wjc/Documents/company/project/demos/async-test/node_modules/.cache/ts-loader',
cacheIdentifier: '41bf2514'
}
},
{
loader: '/Users/wjc/Documents/company/project/demos/async-test/node_modules/babel-loader/lib/index.js'
},
{
loader: 'async-catch-loader',
options: {
catchCode: 'console.error(\'wujingchang\')'
}
}
{
loader: '/Users/wjc/Documents/company/project/demos/async-test/node_modules/ts-loader/index.js',
options: {
transpileOnly: true,
appendTsSuffixTo: [
'\\.vue$'
],
happyPackMode: false
}
},
]
},
But, i don't konw how to add async-catch-loader
to ts
rule which is before babel-loader
and after ts-loader
。Is webpack-chain has feature can do it?