current position:Home>Element - plus on-demand introduced automatically

Element - plus on-demand introduced automatically

2022-11-24 19:30:14tingkeiii

Introduction on demand The volume of the final package will not be so large. With the help of plug-ins to automatically import on-demand, there is no need to manually import it!!!Two plugins are required: unplugin-vue-components, unplugin-auto-import

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

If it is a project created by vite, the configuration in the vite.config.ts file is:

// vite.config.tsimport vue from '@vitejs/plugin-vue'import { defineConfig } from 'vite'import AutoImport from 'unplugin-auto-import/vite'import Components from 'unplugin-vue-components/vite'import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'export default defineConfig({// ...othersplugins: [vue(),AutoImport({resolvers: [ElementPlusResolver()],}),Components({resolvers: [ElementPlusResolver()],}),],})

copyright notice
author[tingkeiii],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/328/202211241926073226.html

Random recommended