```source-js
// webpack.config.js
const tsImportPluginFactory = require('ts-import-plugin')
module.exports = {
// ...
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'awesome-typescript-loader',
options: {
getCustomTransformers: () => ({
before: [ tsImportPluginFactory( /** options */) ]
}),
},
exclude: /node_modules/
}
]
},
// ...
}
// options为UI组件的配置:
// vant:
// tsImportPluginFactory({
// libraryName: 'antd',
// libraryDirectory: 'lib',
// style: true
// })
[参考引用] https://github.com/Brooooooklyn/ts-import-plugin
网友评论