123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import * as path from 'path'
- // https://vitejs.dev/config/
- export default defineConfig({
- plugins: [vue()],
- resolve: {
- alias: {
- '@': path.resolve(__dirname, './src'),
- },
- },
- // 解决跨域问题
- server: {
- host: '0.0.0.0',
- // port: 4000,
- proxy: {
- '/api': {
- target: 'http://127.0.0.1:8222',
- // secure: false, // 请求是否为https
- changeOrigin: true,
- rewrite:(path)=>path.replace(/^\/api/,'') //api替换为'',
- },
- },
- },
- // resolve: {
- // alias: {
- // '@': path.resolve(__dirname, 'src'),
- // },
- // },
- css: {
- preprocessorOptions: {
- less: {
- additionalData: `@import "@/assets/style/base.less";`,
- }
- },
- },
- })
-
|