vue.config.js 1.2 KB

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