TypeError: AutoImport is not a function
原因:unplugin-auto-import
插件版本问题
Vue3基于Webpack,在vue.config.js中配置
- 当
unplugin-vue-components
版本小于0.26.0时,使用以下写法
const { defineConfig } = require("@vue/cli-service")
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
module.exports = defineConfig({
transpileDependencies: true,
configureWebpack: {
plugins: [
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),
]
}
})
- 当
unplugin-vue-components
版本大于等于0.26.0时,使用以下写法
const { defineConfig } = require("@vue/cli-service")
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
module.exports = defineConfig({
transpileDependencies: true,
configureWebpack: {
plugins: [
AutoImport.default({
resolvers: [ElementPlusResolver()],
}),
Components.default({
resolvers: [ElementPlusResolver()],
}),
]
}
})
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » ERROR TypeError: AutoImport is not a function
发表评论 取消回复