12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import { resolve } from 'path'
- export default defineConfig({
- plugins: [vue()],
- //解决“vite use `--host` to expose”
- base: './',
- server: {
- proxy: {
- '/api': {
- target: 'http://192.168.11.77:8888',
- changeOrigin: true,
- rewrite: (path) => {
- return path.replace(/\/api/, '/api')
- }
- },
- '/app': {
- target: 'http://192.168.11.77:8080',
- changeOrigin: true,
- rewrite: (path) => {
- return path.replace(/\/app/, '/api')
- }
- }
- }
- },
- resolve: {
- //别名配置,引用src路径下的东西可以通过@如:import Layout from '@/layout/index.vue'
- alias: [
- {
- find: '@',
- replacement: resolve(__dirname, 'src')
- }
- ]
- },
- css: {
- preprocessorOptions: {
- scss: {
- api: 'modern-compiler'
- }
- },
- },
- })
|