Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to add plugins #1240

Open
langziyang opened this issue Nov 30, 2023 · 1 comment
Open

how to add plugins #1240

langziyang opened this issue Nov 30, 2023 · 1 comment

Comments

@langziyang
Copy link

langziyang commented Nov 30, 2023

this is ui document

npm install -D unplugin-vue-components unplugin-auto-import

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

so when i install plugins,i add plugin like this:

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

Encore
// ....
.addPlugin(AutoImport({
        resolvers: [ElementPlusResolver()],
    }))

when i run yarn run watch, i got error:

TypeError: AutoImport is not a function

how to fix it

@gimler
Copy link
Contributor

gimler commented Jan 5, 2024

@langziyang autoimport ist a Class See original documentation you must call default method See https://github.com/unplugin/unplugin-auto-import

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants