vue.config.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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': '#1890FF',
  44. 'link-color': '#6bc5f3',
  45. 'border-radius-base': '4px',
  46. 'font-color':'#fff', //侧边栏字体颜色
  47. // 'font-color':'#595959', //侧边栏字体颜色
  48. // 'layout-color':'#fff', //侧边栏背景颜色
  49. 'layout-color':' #221140', //侧边栏背景颜色
  50. },
  51. javascriptEnabled: true
  52. }
  53. }
  54. },
  55. devServer: {
  56. port: 3000,
  57. proxy: {
  58. /* '/api': {
  59. target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro', //mock API接口系统
  60. ws: false,
  61. changeOrigin: true,
  62. pathRewrite: {
  63. '/jeecg-boot': '' //默认所有请求都加了jeecg-boot前缀,需要去掉
  64. }
  65. }, */
  66. '/jeecg-boot': {
  67. // target: 'http://127.0.0.1:8090', // 请求本地 需要jeecg-boot后台项目
  68. // target: 'http://106.15.206.14:8087', // 测试环境
  69. target: 'http://220.191.168.86:18087', // 森语外网
  70. // changeOrigin: true
  71. }
  72. }
  73. },
  74. // devServer: {
  75. // assetsSubDirectory:'static',
  76. // assetsPublicPath:'./',
  77. // port: 3000,
  78. // proxy: {
  79. // /* '/api': {
  80. // target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro', //mock API接口系统
  81. // ws: false,
  82. // changeOrigin: true,
  83. // pathRewrite: {
  84. // '/jeecg-boot': '' //默认所有请求都加了jeecg-boot前缀,需要去掉
  85. // }
  86. // }, */
  87. // '/jeecg-boot': {
  88. // // target: 'http://127.0.0.1:8090', // 请求本地 需要jeecg-boot后台项目
  89. // target: 'http://106.15.206.14:8087', // 测试环境
  90. // // ws: false,
  91. // changeOrigin: true
  92. // }
  93. // }
  94. // },
  95. // devServer: {
  96. // assetsSubDirectory:'static',
  97. // assetsPublicPath:'./',
  98. // port: 3000,
  99. // proxy: {
  100. // /* '/api': {
  101. // target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro', //mock API接口系统
  102. // ws: false,
  103. // changeOrigin: true,
  104. // pathRewrite: {
  105. // '/jeecg-boot': '' //默认所有请求都加了jeecg-boot前缀,需要去掉
  106. // }
  107. // }, */
  108. // '/jeecg-boot': {
  109. // // target: 'http://127.0.0.1:8090', // 请求本地 需要jeecg-boot后台项目
  110. // target: 'http://192.168.1.158:8087', // 测试环境
  111. // // ws: false,
  112. // changeOrigin: true
  113. // }
  114. // }
  115. // },
  116. // devServer: {
  117. // assetsSubDirectory:'static',
  118. // assetsPublicPath:'./',
  119. // port: 3000,
  120. // proxy: {
  121. // /* '/api': {
  122. // target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro', //mock API接口系统
  123. // ws: false,
  124. // changeOrigin: true,
  125. // pathRewrite: {
  126. // '/jeecg-boot': '' //默认所有请求都加了jeecg-boot前缀,需要去掉
  127. // }
  128. // }, */
  129. // '/jeecg-boot': {
  130. // // target: 'http://127.0.0.1:8090', // 请求本地 需要jeecg-boot后台项目
  131. // target: 'http://192.168.1.157:8087', // 测试环境
  132. // // ws: false,
  133. // changeOrigin: true
  134. // }
  135. // }
  136. // },
  137. lintOnSave: undefined
  138. // build:{
  139. // index:path.resolve(__dirname,'../dist/index.html'),
  140. // assetsRoot:path.resolve(__dirname,'../dist'),
  141. // assetsSubDirectory:'static',
  142. // assetsPublicPath:'./'
  143. // }
  144. }