123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import {defineConfig} from 'vite'
- import vue from '@vitejs/plugin-vue'
- import * as path from 'path'
- // 自动导入vue中hook reactive ref等
- import AutoImport from "unplugin-auto-import/vite"
- //自动导入ui-组件 比如说ant-design-vue element-plus等
- import Components from 'unplugin-vue-components/vite';
- // https://vitejs.dev/config/
- export default defineConfig({
- plugins: [
- vue(),
- AutoImport({
- //安装两行后你会发现在组件中不用再导入ref,reactive等
- imports: ['vue', 'vue-router'],
- //存放的位置
- dts: "src/auto-import.d.ts",
- }),
- Components({
- // 引入组件的,包括自定义组件
- // 存放的位置
- dts: "src/components.d.ts",
- }),
- ],
- resolve: {
- alias: {
- '@': path.resolve(__dirname, './src'),
- },
- },
- // 解决跨域问题
- server: {
- host: '0.0.0.0',
- // port: 4000,
- proxy: {
- '/api': {
- target: 'http://192.168.110.218:8220',
- // secure: false, // 请求是否为https
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, '') //api替换为'',
- },
- },
- },
- // resolve: {
- // alias: {
- // '@': path.resolve(__dirname, 'src'),
- // },
- // },
- })
|