import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import VueDevTools from 'vite-plugin-vue-devtools' import VueSetupExtend from 'vite-plugin-vue-setup-extend' import autoImport from 'unplugin-auto-import/vite' import AutoImport from 'unplugin-auto-import/vite' import Components from 'unplugin-vue-components/vite' import { VantResolver } from '@vant/auto-import-resolver' const createAutoImport = () => { return autoImport({ imports: ['vue', 'vue-router', 'pinia'], dts: false }) } // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue(), VueDevTools(), VueSetupExtend(), createAutoImport(), AutoImport({ resolvers: [VantResolver()] }), Components({ resolvers: [VantResolver()] }) ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }, server: { host: true }, //配置sass css: { preprocessorOptions: { scss: { additionalData: '@import "./src/assets/scss/globalVar.scss";@import "./src/assets/scss/globalMixin.scss";' } } } })