1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 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,
- proxy: {
- '/dev-api': {
- target: 'http://172.16.10.61:8080',
- // target: 'https://vue.ruoyi.vip/prod-api',
- changeOrigin: true,
- rewrite: (p) => p.replace(/^\/dev-api/, '')
- }
- }
- },
- //配置sass
- css: {
- preprocessorOptions: {
- scss: {
- additionalData:
- '@import "./src/assets/scss/globalVar.scss";@import "./src/assets/scss/globalMixin.scss";'
- }
- }
- }
- })
|