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博客

相关推荐
西洼工作室20 小时前
Vue CLI为何不显示webpack配置
前端·vue.js·webpack
富贵2号2 天前
从零开始理解 Webpack:构建现代前端工程的基石
webpack
Hashan4 天前
告别混乱开发!多页面前端工程化完整方案(Webpack 配置 + 热更新)
webpack
开心不就得了5 天前
构建工具webpack
前端·webpack·rust
鲸落落丶6 天前
webpack学习
前端·学习·webpack
闲蛋小超人笑嘻嘻6 天前
前端面试十四之webpack和vite有什么区别
前端·webpack·node.js
guslegend6 天前
Webpack5 第五节
webpack
海涛高软8 天前
qt使用opencv的imread读取图像为空
qt·opencv·webpack
行者..................8 天前
手动编译 OpenCV 4.1.0 源码,生成 ARM64 动态库 (.so),然后在 Petalinux 中打包使用。
前端·webpack·node.js
千叶寻-8 天前
package.json详解
前端·vue.js·react.js·webpack·前端框架·node.js·json