vue.config.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. const path = require('path')
  2. function resolve(dir) {
  3. return path.join(__dirname, dir)
  4. }
  5. module.exports = {
  6. parallel: false,
  7. configureWebpack: {
  8. externals: {
  9. vue: 'Vue',
  10. vuex: 'Vuex',
  11. 'vue-router': 'VueRouter',
  12. axios: 'axios',
  13. }
  14. },
  15. outputDir:'../../public/building/',
  16. assetsDir:'',
  17. indexPath:'../../public/building.html',
  18. productionSourceMap: false, // 关键语句
  19. publicPath: process.env.NODE_ENV === 'production' ? './building/' : '',
  20. css: {
  21. // 是否使用css分离插件 ExtractTextPlugin
  22. // extract: true,
  23. // 开启 CSS source maps?
  24. sourceMap: false,
  25. // css预设器配置项
  26. loaderOptions: {
  27. postcss: {
  28. plugins: [
  29. require('postcss-px2rem-exclude')({ //配置项,详见官方文档
  30. remUnit: 75, // 换算的基数
  31. exclude: /node_modules/
  32. })
  33. ]
  34. },
  35. less: {
  36. javascriptEnabled: true,
  37. globalVars: {
  38. primary: '#fff'
  39. }
  40. }
  41. },
  42. requireModuleExtension: true
  43. },
  44. devServer: {
  45. proxy: {
  46. "/client": {
  47. // saastest.zhuangqixiaoguan.com
  48. // h5.zqxg.cc
  49. target: "https://h5.zqxg.cc/client", //设置你调用的接口域名和端口号 别忘了加http、https
  50. changeOrigin: true, //是否跨域
  51. // secure: true, // 允许https请求
  52. ws: true,
  53. pathRewrite: {
  54. "^/client": "" //这里理解成用‘/api’代替target里面的地址
  55. }
  56. },
  57. "/api": {
  58. target: "https://h5.zqxg.cc/api", //设置你调用的接口域名和端口号 别忘了加http、https
  59. changeOrigin: true, //是否跨域
  60. // secure: true, // 允许https请求
  61. ws: true,
  62. pathRewrite: {
  63. "^/api": "" //这里理解成用‘/api’代替target里面的地址
  64. }
  65. },
  66. "/mobile": {
  67. target: "https://h5.zqxg.cc/mobile", //设置你调用的接口域名和端口号 别忘了加http、https
  68. changeOrigin: true, //是否跨域
  69. secure: true, // 允许https请求
  70. ws: true,
  71. pathRewrite: {
  72. "^/mobile": "" //这里理解成用‘/api’代替target里面的地址
  73. }
  74. },
  75. "/index": {
  76. target: "https://h5.zqxg.cc/index", //设置你调用的接口域名和端口号 别忘了加http、https
  77. changeOrigin: true, //是否跨域
  78. // secure: true, // 允许https请求
  79. ws: true,
  80. pathRewrite: {
  81. "^/index": "" //这里理解成用‘/api’代替target里面的地址
  82. }
  83. },
  84. }
  85. }
  86. }