123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import AutoImport from 'unplugin-auto-import/vite'
- export const autoImportPlugin = () => {
- return AutoImport({
- include: [
- /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
- /\.vue$/,
- /\.vue\?vue/, // .vue
- /\.md$/ // .md
- ],
- imports: [
- // presets
- 'vue',
- 'vue-router',
- 'pinia',
- // custom
- {
- '/@/hooks/web/useMessage': ['useMessage'],
- '/@/utils/file/image': ['getAssetsImageUrl', 'getRelativeImageUrl']
- // "@vueuse/core": [
- // // named imports
- // "useMouse", // import { useMouse } from '@vueuse/core',
- // // alias
- // ["useFetch", "useMyFetch"], // import { useFetch as useMyFetch } from '@vueuse/core',
- // ],
- // axios: [
- // // default imports
- // ["default", "axios"], // import { default as axios } from 'axios',
- // ],
- // "[package-name]": [
- // "[import-names]",
- // // alias
- // ["[from]", "[alias]"],
- // ],
- }
- // example type import
- // {
- // from: "vue-router",
- // imports: ["RouteLocationRaw"],
- // type: true,
- // },
- ],
- vueTemplate: true,
- eslintrc: {
- enabled: true,
- globalsPropValue: true
- }
- // Custom
- // resolvers: [IconsResolver()],
- })
- }
|