1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import * as path from "path";
- const resolve = (dir) => path.resolve(__dirname, dir);
- import { fileURLToPath, URL } from 'node:url'
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import AutoImport from 'unplugin-auto-import/vite'
- import Components from 'unplugin-vue-components/vite'
- import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
- // https://vitejs.dev/config/
- export default defineConfig({
- server:{
- cors: true,
- proxy: {
- // 代理所有 /api 的请求,该求情将被代理到 target 中
- '/api': {
- // 代理请求之后的请求地址(你的真实接口地址)
- target: 'https://datamidplat.zjw.sh.cegn.cn:2011/data-business-prod/',
- //target: 'http://localhost:9250',
- secure: false,
- ws: true,
- // 跨域
- // configure: (proxy) => {
- // proxy.on('proxyReq', function (proxyReq) {
- // proxyReq.removeHeader('referer')
- // proxyReq.removeHeader('origin')
- // proxyReq.setHeader('host','10.90.11.49:2002')
- // })
- // },
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, '')
- }
- },
- },
- // https:true,
- build: {
- sourcemap: true
- },
- css:{
- devSourcemap:true
- },
- devtool: 'source-map',
- plugins: [
- vue(),
- AutoImport({
- resolvers: [ElementPlusResolver()],
- }),
- Components({
- resolvers: [ElementPlusResolver()],
- }),
- ],
- base:'./',
- publicDir: resolve('static'),
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- }
- })
|