vue.config.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // const targetUrl = 'https://apizng.eavic.com';
  2. // const targetUrl = 'http://39.97.239.116:8080';
  3. // const targetUrl = 'http://192.168.1.200:8080';
  4. const targetUrl = 'http://192.168.1.195/'
  5. // const targetUrl = 'https://www.xyzshops.cn/'
  6. // const targetUrl = 'http://10.64.81.2:8080';
  7. module.exports = {
  8. publicPath:'./',
  9. productionSourceMap: false,
  10. pages: {
  11. index: {
  12. // page 的入口
  13. entry: 'src/main.js',
  14. // 模板来源
  15. template: 'public/index.html',
  16. // 在 dist/index.html 的输出
  17. filename: 'index.html',
  18. // 当使用 title 选项时,template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
  19. // title: '航空工业集团快递智能柜管理程序'
  20. title: '椰子充值后台管理系统程序'
  21. },
  22. },
  23. devServer: {
  24. open: true,
  25. // host: 'localhost',
  26. host: '192.168.1.130',
  27. port: 3333,
  28. https: false,
  29. //以上的ip和端口是我们本机的;下面为需要跨域的
  30. proxy: {//配置跨域
  31. '/api': {
  32. target: targetUrl,//这里后台的地址模拟的;应该填写你们真实的后台接口
  33. ws: true,
  34. changOrigin: true,//允许跨域
  35. pathRewrite: {
  36. '^/api': ''//请求的时候使用这个api就可以
  37. }
  38. }
  39. }
  40. },
  41. chainWebpack: config => {
  42. config.module
  43. .rule("css")
  44. .test(/\.css$/)
  45. .oneOf("vue")
  46. .resourceQuery(/\?vue/)
  47. .use("px2rem")
  48. .loader("px2rem-loader")
  49. .options({
  50. // remUnit: 192
  51. remUnit: 210
  52. });
  53. }
  54. }