You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

60 lines
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. publicPath: './',
  15. // Project deployment base
  16. // By default we assume your app will be deployed at the root of a domain,
  17. // e.g. https://www.my-app.com/
  18. // If your app is deployed at a sub-path, you will need to specify that
  19. // sub-path here. For example, if your app is deployed at
  20. // https://www.foobar.com/my-app/
  21. // then change this to '/my-app/'
  22. // baseUrl: BASE_URL,
  23. // tweak internal webpack configuration.
  24. // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
  25. chainWebpack: config => {
  26. config.resolve.alias
  27. .set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components'))
  28. .set('_c', resolve('src/components'))
  29. .set('_conf', resolve('config'))
  30. },
  31. // 打包时不生成.map文件
  32. productionSourceMap: false,
  33. // 这里写你调用接口的基础路径,来解决跨域,如果设置了代理,那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串
  34. devServer: {
  35. overlay: { // 让浏览器 overlay 同时显示警告和错误
  36. warnings: true,
  37. errors: true
  38. },
  39. host: "localhost",
  40. port: 8080, // 端口号
  41. https: false, // https:{type:Boolean}
  42. open: false, //配置自动启动浏览器
  43. hotOnly: true,
  44. proxy: {
  45. '/api': {
  46. target: 'http://47.100.188.195:7006',
  47. ws: true,
  48. changeOrigin: true,
  49. secure: false,
  50. pathRewrite: {
  51. "^/api": "/"
  52. }
  53. }
  54. }
  55. }
  56. }