12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import { defineConfig } from 'vite'
- import path from "path"
- import react from '@vitejs/plugin-react'
- import vitePluginImp from 'vite-plugin-imp'
-
- // https://vitejs.dev/config/
- export default defineConfig({
- server: {
- proxy: {
- '/api/': {
- // 要代理的地址
- target: 'http://jgz.njyunzhi.com',
- // 配置了这个可以从 http 代理到 https
- // 依赖 origin 的功能可能需要这个,比如 cookie
- changeOrigin: true,
- },
- }
- },
- plugins: [
- react(),
- vitePluginImp({
- libList: [
- {
- libName: 'antd',
- style: (name) => `antd/es/${name}/style`,
- }
- ]
- })
- ],
- resolve: {
- alias: [
- { find: '@', replacement: path.resolve(__dirname, 'src') },
- ],
- },
- css: {
- preprocessorOptions: {
- less: {
- // modifyVars: { 'primary-color': '#13c2c2' },
- javascriptEnabled: true,
- },
- },
- },
- })
|