123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- import { fileURLToPath, URL } from 'node:url'
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import postcsspxtoviewport from 'postcss-px-to-viewport'
- 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://cimweb.zjw.sh.cegn.cn:2007/data-business-prod/',
- //target: 'http://localhost:9250/',
- secure: false,
- ws: true,
- // 跨域
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, '')
- },
- '/addressapi': {
- // 代理请求之后的请求地址(你的真实接口地址)
- target: 'https://cimweb.zjw.sh.cegn.cn:2008/',
- //target: 'http://localhost:9250/',
- secure: false,
- ws: true,
- // 跨域
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/addressapi/, '')
- },
- '/netapi': {
- // 代理请求之后的请求地址(你的真实接口地址)
- target: 'http://58.34.215.19:8100/',
- //target: 'http://localhost:9250/',
- secure: false,
- ws: true,
- // 跨域
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/netapi/, '')
- },
- '/zwapi': {
- // 代理请求之后的请求地址(你的真实接口地址)
- target: 'http://10.90.9.143:9252/',
- //target: 'http://localhost:9250/',
- secure: false,
- ws: true,
- // 跨域
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/zwapi/, '')
- }
- },
- },
- plugins: [
- vue(),
- AutoImport({
- resolvers: [ElementPlusResolver()],
- }),
- Components({
- resolvers: [ElementPlusResolver()],
- }),
- ],
- build: {
- outDir: 'low_altitude_web'
- },
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- },
- css: {
- preprocessorOptions: {
- scss: {
- api: "modern-compiler" // or 'modern'
- }
- },
- postcss: {
- plugins: [
- postcsspxtoviewport({
- unitToConvert: "px", // 要转化的单位
- viewportWidth: 1080, // UI设计稿的宽度
- unitPrecision: 6, // 转换后的精度,即小数点位数
- propList: ["*"], // 指定转换的css属性的单位,*代表全部css属性的单位都进行转换
- viewportUnit: "vh", // 指定需要转换成的视窗单位,默认vw
- fontViewportUnit: "vh", // 指定字体需要转换成的视窗单位,默认vw
- selectorBlackList: [], // 指定不转换为视窗单位的类名,
- minPixelValue: 1, // 默认值1,小于或等于1px则不进行转换
- mediaQuery: true, // 是否在媒体查询的css代码中也进行转换,默认false
- replace: true, // 是否转换后直接更换属性值
- exclude: [/node_modules/], // 设置忽略文件,用正则做目录名匹配
- // include: [/overview_4k/],
- landscape: false // 是否处理横屏情况
- }),
- ]
- }
- },
- base: '/low_altitude/'
- })
|