vue.config.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // const targetUrl = 'http://192.168.1.220/'
  2. // const targetUrl = 'http://192.168.1.218/'
  3. // const targetUrl = 'http://dd.guozipay.com/'
  4. // const targetUrl = 'https://admin.xyzshops.cn/'
  5. const targetUrl = 'https://co-data.zylife.co/'
  6. // const targetUrl = 'https://test.xyzshops.cn/'
  7. // 椰子临时线上
  8. // const targetUrl = 'http://121.89.196.45/'
  9. //椰林接口地址
  10. // const targetUrl = 'https://ylweb.xyzshops.cn/';
  11. module.exports = {
  12. publicPath:'./',
  13. productionSourceMap: false,
  14. pages: {
  15. index: {
  16. // page 的入口
  17. entry: 'src/main.js',
  18. // 模板来源
  19. template: 'public/index.html',
  20. // 在 dist/index.html 的输出
  21. filename: 'index.html',
  22. // 当使用 title 选项时,template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
  23. title: `广信通信客户服务平台`,
  24. },
  25. },
  26. devServer: {
  27. open: true,
  28. host: 'localhost',
  29. // host: '10.128.216.95',
  30. port: 3333,
  31. https: false,
  32. //以上的ip和端口是我们本机的;下面为需要跨域的
  33. proxy: {//配置跨域
  34. '/api': {
  35. target: targetUrl,//这里后台的地址模拟的;应该填写你们真实的后台接口
  36. ws: true,
  37. changOrigin: true,//允许跨域
  38. pathRewrite: {
  39. '^/api': ''//请求的时候使用这个api就可以
  40. }
  41. },
  42. }
  43. },
  44. chainWebpack: config => {
  45. config.module
  46. .rule("css")
  47. .test(/\.css$/)
  48. .oneOf("vue")
  49. .resourceQuery(/\?vue/)
  50. .use("px2rem")
  51. .loader("px2rem-loader")
  52. .options({
  53. // remUnit: 192
  54. remUnit: 210
  55. });
  56. },
  57. // 打包去掉console.log
  58. // configureWebpack: (config) => {
  59. // if (process.env.NODE_ENV === 'production') {
  60. // config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
  61. // }
  62. // }
  63. }