import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import vitePluginImport from 'vite-plugin-babel-import'; import path from 'path' import postCssPxToRem from "postcss-pxtorem"; const baseUrl = { development: './', beta: './', release: './' } // https://vitejs.dev/config/ export default ({ mode }) => defineConfig({ plugins: [ vue() ], base: baseUrl[mode], resolve: { alias: { '~': path.resolve(__dirname, './'), '@': path.resolve(__dirname, 'src') } }, css: { postcss: { plugins: [ postCssPxToRem({ rootValue: 192, // (设计稿/10)1rem的大小 propList: ["*"], // 除 border/font-size 外所有px 转 rem }) ] }, }, server: { proxy: { '/api': { // target: 'http://cdcm_test_api.shikicc.com:58909', // target: 'http://frp.shikicc.com:58951', // target: 'https://cdcm_api2.shikicc.com', target: 'https://cdcm_api.shikicc.com', // target: 'http://localhost:8088', changeOrigin: true, rewrite: path => path.replace(/^\/api/, '/api') } } } })