webpack配置
javascript
// webpack.config.js
const IconsResolver = require("unplugin-icons/resolver");
module.exports = {
// ...
configureWebpack: (config) => {
// ...
config.plugins.push(
AutoImport({
resolvers: [
// 自动导入图标组件
IconsResolver({
prefix: "Icon",
}),
// ...
],
})
);
config.plugins.push(
Components({
resolvers: [
// 自动注册图标组件
IconsResolver({
enabledCollections: ["ep"],
}),
// ...
],
})
);
}
}
运行结果:TypeError: IconsResolver is not a function
解决方式:安装低版本unplugin-icons
bash
yarn add unplugin-icons@0.14.1 -D