No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

59 líneas
2.0 KiB

  1. const path = require('path')
  2. const resolve = dir => {
  3. return path.join(__dirname, dir)
  4. }
  5. // 项目部署基础
  6. // 默认情况下,我们假设你的应用将被部署在域的根目录下,
  7. // 例如:https://www.my-app.com/
  8. // 默认:'/'
  9. // 如果您的应用程序部署在子路径中,则需要在这指定子路径
  10. // 例如:https://www.foobar.com/my-app/
  11. // 需要将它改为'/my-app/'
  12. const BASE_URL = process.env.NODE_ENV === 'production' ? '/' : '/'
  13. module.exports = {
  14. // Project deployment base
  15. // By default we assume your app will be deployed at the root of a domain,
  16. // e.g. https://www.my-app.com/
  17. // If your app is deployed at a sub-path, you will need to specify that
  18. // sub-path here. For example, if your app is deployed at
  19. // https://www.foobar.com/my-app/
  20. // then change this to '/my-app/'
  21. // baseUrl: BASE_URL,
  22. // tweak internal webpack configuration.
  23. // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
  24. chainWebpack: config => {
  25. config.resolve.alias
  26. .set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components'))
  27. .set('_c', resolve('src/components'))
  28. .set('_conf', resolve('config'))
  29. },
  30. // 打包时不生成.map文件
  31. productionSourceMap: false,
  32. // 这里写你调用接口的基础路径,来解决跨域,如果设置了代理,那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串
  33. devServer: {
  34. overlay: { // 让浏览器 overlay 同时显示警告和错误
  35. warnings: true,
  36. errors: true
  37. },
  38. host: "localhost",
  39. port: 8080, // 端口号
  40. https: false, // https:{type:Boolean}
  41. open: false, //配置自动启动浏览器
  42. hotOnly: true,
  43. proxy: {
  44. '/api': {
  45. target: 'http://47.100.188.195:7006',
  46. ws: true,
  47. changeOrigin: true,
  48. secure: false,
  49. pathRewrite: {
  50. "^/api": "/"
  51. }
  52. }
  53. }
  54. }
  55. }