vue.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // const targetUrl = 'http://39.97.239.116:8080';
  2. // const targetUrl = 'http://api.zng.com:8080';
  3. const targetUrl = 'http://192.168.1.200:8080';
  4. module.exports = {
  5. publicPath:'./',
  6. productionSourceMap: false,
  7. pages: {
  8. index: {
  9. // page 的入口
  10. entry: 'src/main.js',
  11. // 模板来源
  12. template: 'public/index.html',
  13. // 在 dist/index.html 的输出
  14. filename: 'index.html',
  15. // 当使用 title 选项时,template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
  16. title: '航空工业集团快递智能柜管理程序'
  17. },
  18. },
  19. devServer: {
  20. open: true,
  21. // host: 'localhost',
  22. port: 8080,
  23. https: false,
  24. //以上的ip和端口是我们本机的;下面为需要跨域的
  25. proxy: {//配置跨域
  26. '/api': {
  27. target: targetUrl,//这里后台的地址模拟的;应该填写你们真实的后台接口
  28. ws: true,
  29. changOrigin: true,//允许跨域
  30. pathRewrite: {
  31. '^/api': ''//请求的时候使用这个api就可以
  32. }
  33. }
  34. }
  35. },
  36. }