element-plus按需引入报错AutoImport is not a function

官网文档:快速开始 | Element Plus

webpack配置

javascript 复制代码
// webpack.config.js
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')

module.exports = {
  // ...
  plugins: [
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
}

运行结果:TypeError: AutoImport is not a function

解决方式:安装低版本nplugin-auto-import

bash 复制代码
yarn add [email protected] -D

关联问题Components is not a function参考

element-plus按需引入报错Components is not a function-CSDN博客

相关推荐
和雍3 小时前
”做技术分享?苟都不做“做,做的就是 module.rules 加工过程
javascript·面试·webpack
贩卖纯净水.19 小时前
Webpack搭建本地服务器
前端·webpack·node.js
菠菜70720 小时前
一篇带你速通Webpack如何处理框架中的难点
前端·javascript·webpack
遗憾随她而去.21 小时前
Web前端为什么要打包?Webpack 和 Vite 如何助力现代开发?
前端·webpack·node.js
南吕二七21 小时前
webPack基本使用步骤
前端·webpack·node.js
贩卖纯净水.1 天前
webpack继续学习
前端·学习·webpack
MiyueFE3 天前
深入理解Webpack的灵魂:Tapable插件架构解析
前端·webpack
贩卖纯净水.4 天前
邂逅Webpack和打包过程
前端·webpack·node.js
胡桃夹夹子4 天前
【前端优化】使用speed-measure-webpack-plugin分析前端运行、打包耗时,优化项目
前端·webpack·node.js
赵庆明老师5 天前
webpack打包基本配置
前端·webpack·node.js