12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- import { defineConfig, loadEnv } from 'vite'
- import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
- import vue from '@vitejs/plugin-vue'
- import ViteComponents from 'unplugin-vue-components/vite'
- import DefineOptions from 'unplugin-vue-define-options/vite'
- import { resolve } from 'path'
- // https://vitejs.dev/config/
- export default ({ mode }) => {
- const env = loadEnv(mode, process.cwd())
- const proxy = {
- '/api': {
- target: 'https://test.4dkankan.com',
- changeOrigin: true,
- rewrite: path => path.replace(/^\/api/, '')
- },
- '/local': {
- target: 'http://192.168.0.152:8111',
- changeOrigin: true,
- rewrite: path => path.replace(/^\/local/, '')
- }
- }
- return defineConfig({
- base: './',
- plugins: [
- vue(),
- DefineOptions(),
- ViteComponents({
- resolvers: [
- AntDesignVueResolver({ resolveIcons: true, importStyle: 'less' })
- ],
- dts: 'src/components.d.ts'
- })
- ],
- css: {
- preprocessorOptions: {
- less: {
- javascriptEnabled: true,
- modifyVars: {
- 'primary-color': '#0076F6',
- 'link-color': '#0076F6',
- 'border-radius-base': '2px'
- }
- }
- }
- },
- resolve: {
- alias: [
- {
- find: '@',
- replacement: resolve(__dirname, './src')
- }
- ]
- },
- server: {
- host: '0.0.0.0',
- port: 5173,
- open: true,
- proxy: proxy
- }
- })
- }
|