module.exports = {
  lintOnSave: false,
  devServer: {
    proxy: {
      '/api': {
        target: 'http://local.xinsiketang.com',
        changeOrigin: true,
        // pathRewrite: {
        //   '^/api': '/api'
        // },
        logLevel: 'debug', // 用于调试时查看代理请求详情
        onProxyRes(proxyRes, req, res) {
          let responseBody = '';
          proxyRes.on('data', (chunk) => {
            responseBody += chunk;
          });
          proxyRes.on('end', () => {
            // console.log('Proxy response body:', responseBody);
          });
          console.log('Proxy response:', res.statusCode);
        }
      }
    }
  },
  configureWebpack: {
    devtool: 'source-map'
  }
}
