Solution: Invalid options in vue.config.js: “plugins“ is not allowed. Error message when using vue-cli to automatically import element-plus.

 When automatically importing element-plus in the project created by vue-cli, configure vue.config.js according to the guide, and an error will be reported when running.

Solution : Webpack-  related configurations need to be written in configureWebpack and cannot be written directly outside.

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()]
      })
    ]
  }
})

Guess you like

Origin blog.csdn.net/m0_62323730/article/details/130124312