pyt
2025-03-04 12a6374f0f13d06314ef9c8a9fa021ae07be0198
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module.exports = {
  publicPath: './',
  // publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
  devServer: {
    disableHostCheck: true,
  },
  lintOnSave: false,
  devServer: {
    proxy: { //跨域配置
      "/api": { //是自定义的本地请求时的名字
        // target: "http://192.168.110.64:8000",
        target: "http://vwpmxwbhv59i.guyubao.com",
        changeOrigin: true, //在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
        pathRewrite: { //路径重写
          "^/api": "/" // '^/api'是一个正则表达式,表示要匹配请求的url中,全部 '/api' 转接为 '/'
        }
      },
    }
  },
 
  css: {
    loaderOptions: {
      postcss: {
        plugins: [require('tailwindcss'), require('autoprefixer')]
      }
    }
  },
}