auto-import.ts 807 B

123456789101112131415161718192021222324
  1. import AutoImport from 'unplugin-auto-import/vite';
  2. import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
  3. import IconsResolver from 'unplugin-icons/resolver';
  4. export default (path: any) => {
  5. return AutoImport({
  6. // 自动导入 Vue 相关函数
  7. imports: ['vue', 'vue-router', '@vueuse/core', 'pinia'],
  8. eslintrc: {
  9. enabled: false,
  10. filepath: './.eslintrc-auto-import.json',
  11. globalsPropValue: true
  12. },
  13. resolvers: [
  14. // 自动导入 Element Plus 相关函数ElMessage, ElMessageBox... (带样式)
  15. ElementPlusResolver(),
  16. IconsResolver({
  17. prefix: 'Icon'
  18. })
  19. ],
  20. vueTemplate: true, // 是否在 vue 模板中自动导入
  21. dts: path.resolve(path.resolve(__dirname, '../../src'), 'types', 'auto-imports.d.ts')
  22. });
  23. };