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 unplugin-auto-import@0.16.1 -D

关联问题Components is not a function参考

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

相关推荐
GISer_Jing1 天前
OpenCV头文件路径配置终极修复指南
javascript·opencv·webpack
U***e631 天前
前端构建工具迁移,Webpack到Vite
前端·webpack·node.js
q***d1733 天前
前端微前端部署方案,Nginx与Webpack
前端·nginx·webpack
嫂子的姐夫3 天前
23-MD5+DES+Webpack:考试宝
java·爬虫·python·webpack·node.js·逆向
y***54883 天前
前端构建工具扩展,Webpack插件开发
前端·webpack·node.js
4***14903 天前
前端构建工具多页面配置,Webpack与Vite
前端·webpack·node.js
百***84454 天前
Webpack、Vite区别知多少?
前端·webpack·node.js
天天进步20154 天前
Webpack到Vite:构建工具迁移实战经验总结
前端·webpack·node.js
0***144 天前
免费的WebAssembly模块打包,Webpack配置
前端·webpack·wasm
qq_415216255 天前
vue3搭建项目yarn+vue3+webpack+less+element-plus
前端·webpack·less