曹睿
2025-06-23 920ff9074e6e925c99a051cb4669553047c178b4
vite.config.js
@@ -6,6 +6,10 @@
export default defineConfig(({ mode, command }) => {
  const env = loadEnv(mode, process.cwd())
  const { VITE_APP_ENV } = env
  const baseUrl = VITE_APP_ENV == 'development'
    ? 'http://192.168.10.2:7003' // 开发环境后端接口
    : 'http://114.132.189.42:7004' // 生产环境后端接口
  return {
    // 部署生产环境和开发环境下的URL。
    // 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上
@@ -46,13 +50,17 @@
      proxy: {
        // https://cn.vitejs.dev/config/#server-proxy
        '/dev-api': {
          target: 'http://localhost:8080',
          target: baseUrl,
          changeOrigin: true,
          rewrite: (p) => p.replace(/^\/dev-api/, '')
        },
         // springdoc proxy
         '^/v3/api-docs/(.*)': {
          target: baseUrl,
          changeOrigin: true,
        }
      }
    },
    //fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
    css: {
      postcss: {
        plugins: [
@@ -61,7 +69,7 @@
            AtRule: {
              charset: (atRule) => {
                if (atRule.name === 'charset') {
                  atRule.remove();
                  atRule.remove()
                }
              }
            }