123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- 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'
- import postcsspxtoviewport8plugin from 'postcss-px-to-viewport-8-plugin'
- export default defineConfig({
- server:{
- cors: true,
- proxy: {
-
- '/api': {
-
- target: 'https://cimweb.zjw.sh.cegn.cn:2007/data-business-prod/',
-
- secure: false,
- ws: true,
-
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, '')
- },
- '/addressapi': {
-
- target: 'https://cimweb.zjw.sh.cegn.cn:2008/',
-
- secure: false,
- ws: true,
-
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/addressapi/, '')
- }
- },
- },
- css:{
- postcss:{
- plugins:[
- postcsspxtoviewport8plugin({
- unitToConvert: 'px',
- viewportWidth: 1920,
- unitPrecision: 6,
- propList: [
- 'width',
- 'left',
- 'right',
- 'font-size',
- 'margin-left',
- 'margin-right',
- 'text-indent',
- 'padding-left',
- 'padding-right',
- 'padding',
- ],
- viewportUnit: 'vw',
- fontViewportUnit: 'vw',
- selectorBlackList: ['ignore-'],
- minPixelValue: 1,
- mediaQuery: true,
- replace: true,
- exclude: [/node_modules/],
-
- include: [
- /\/src\/pages\/amap\/factor-monitor.vue/,
- ],
- landscape: false,
- }),
-
- postcsspxtoviewport8plugin({
- unitToConvert: 'px',
- viewportWidth: 1080,
- unitPrecision: 6,
- propList: [
- 'height',
- 'top',
- 'bottom',
- 'margin-top',
- 'margin-bottom',
- 'padding-top',
- 'padding-bottom',
- 'line-height',
- ],
- viewportUnit: 'vh',
- fontViewportUnit: 'vh',
- selectorBlackList: ['ignore-'],
- minPixelValue: 1,
- mediaQuery: true,
- replace: true,
- exclude: [/node_modules/],
-
- include: [
- /\/src\/pages\/amap\/factor-monitor.vue/,
- ],
- landscape: false,
- })
- ]
- }
- },
- plugins: [vue(), AutoImport({
- resolvers: [ElementPlusResolver()],
- }),
- Components({
- resolvers: [ElementPlusResolver()],
- }),],
- base:'./',
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- }
- })
|