vue.config.js 4.7 KB

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