vue.config.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. const path = require ('path')
  2. function resolve(dir) {
  3. return path.join(__dirname, dir)
  4. }
  5. // vue.config.js
  6. module.exports = {
  7. /*
  8. Vue-cli3:
  9. Crashed when using Webpack `import()` #2463
  10. https://github.com/vuejs/vue-cli/issues/2463
  11. */
  12. // 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
  13. productionSourceMap: false,
  14. // 打包app时放开该配置
  15. // publicPath:'./',
  16. configureWebpack: config => {
  17. // 生产环境取消 console.log
  18. if (process.env.NODE_ENV === 'production') {
  19. config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
  20. }
  21. },
  22. chainWebpack: (config) => {
  23. config.resolve.alias
  24. .set('@$', resolve('src'))
  25. .set('@api', resolve('src/api'))
  26. .set('@assets', resolve('src/assets'))
  27. .set('@comp', resolve('src/components'))
  28. .set('@views', resolve('src/views'))
  29. .set('@layout', resolve('src/layout'))
  30. // 配置 webpack 识别 markdown 为普通的文件
  31. config.module
  32. .rule('markdown')
  33. .test(/\.md$/)
  34. .use()
  35. .loader('file-loader')
  36. .end()
  37. },
  38. css: {
  39. loaderOptions: {
  40. less: {
  41. modifyVars: {
  42. /* less 变量覆盖,用于自定义 ant design 主题 */
  43. 'primary-color': '#6bc5f3',
  44. 'link-color': '#1890FF',
  45. 'border-radius-base': '4px',
  46. 'font-color':'#595959', //侧边栏字体颜色
  47. 'layout-color':'#fff', //侧边栏背景颜色
  48. },
  49. javascriptEnabled: true
  50. }
  51. }
  52. },
  53. devServer: {
  54. port: 3000,
  55. proxy: {
  56. /* '/api': {
  57. target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro', //mock API接口系统
  58. ws: false,
  59. changeOrigin: true,
  60. pathRewrite: {
  61. '/jeecg-boot': '' //默认所有请求都加了jeecg-boot前缀,需要去掉
  62. }
  63. }, */
  64. '/jeecg-boot': {
  65. // target: 'http://127.0.0.1:8090', // 请求本地 需要jeecg-boot后台项目
  66. // target: 'http://106.15.206.14:8087', // 测试环境
  67. target: 'http://220.191.168.86:18087', // 森语外网
  68. // changeOrigin: true
  69. }
  70. }
  71. },
  72. // devServer: {
  73. // assetsSubDirectory:'static',
  74. // assetsPublicPath:'./',
  75. // port: 3000,
  76. // proxy: {
  77. // /* '/api': {
  78. // target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro', //mock API接口系统
  79. // ws: false,
  80. // changeOrigin: true,
  81. // pathRewrite: {
  82. // '/jeecg-boot': '' //默认所有请求都加了jeecg-boot前缀,需要去掉
  83. // }
  84. // }, */
  85. // '/jeecg-boot': {
  86. // // target: 'http://127.0.0.1:8090', // 请求本地 需要jeecg-boot后台项目
  87. // target: 'http://106.15.206.14:8087', // 测试环境
  88. // // ws: false,
  89. // changeOrigin: true
  90. // }
  91. // }
  92. // },
  93. // devServer: {
  94. // assetsSubDirectory:'static',
  95. // assetsPublicPath:'./',
  96. // port: 3000,
  97. // proxy: {
  98. // /* '/api': {
  99. // target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro', //mock API接口系统
  100. // ws: false,
  101. // changeOrigin: true,
  102. // pathRewrite: {
  103. // '/jeecg-boot': '' //默认所有请求都加了jeecg-boot前缀,需要去掉
  104. // }
  105. // }, */
  106. // '/jeecg-boot': {
  107. // // target: 'http://127.0.0.1:8090', // 请求本地 需要jeecg-boot后台项目
  108. // target: 'http://192.168.1.158:8087', // 测试环境
  109. // // ws: false,
  110. // changeOrigin: true
  111. // }
  112. // }
  113. // },
  114. // devServer: {
  115. // assetsSubDirectory:'static',
  116. // assetsPublicPath:'./',
  117. // port: 3000,
  118. // proxy: {
  119. // /* '/api': {
  120. // target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro', //mock API接口系统
  121. // ws: false,
  122. // changeOrigin: true,
  123. // pathRewrite: {
  124. // '/jeecg-boot': '' //默认所有请求都加了jeecg-boot前缀,需要去掉
  125. // }
  126. // }, */
  127. // '/jeecg-boot': {
  128. // // target: 'http://127.0.0.1:8090', // 请求本地 需要jeecg-boot后台项目
  129. // target: 'http://192.168.1.157:8087', // 测试环境
  130. // // ws: false,
  131. // changeOrigin: true
  132. // }
  133. // }
  134. // },
  135. lintOnSave: undefined
  136. // build:{
  137. // index:path.resolve(__dirname,'../dist/index.html'),
  138. // assetsRoot:path.resolve(__dirname,'../dist'),
  139. // assetsSubDirectory:'static',
  140. // assetsPublicPath:'./'
  141. // }
  142. }