vue.config.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. /*
  15. pages: {
  16. index: {
  17. entry: 'src/main.js',
  18. chunks: ['chunk-vendors', 'chunk-common', 'index']
  19. }
  20. },
  21. */
  22. configureWebpack: config => {
  23. //生产环境取消 console.log
  24. if (process.env.NODE_ENV === 'production') {
  25. config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
  26. }
  27. },
  28. chainWebpack: (config) => {
  29. config.resolve.alias
  30. .set('@$', resolve('src'))
  31. .set('@api', resolve('src/api'))
  32. .set('@assets', resolve('src/assets'))
  33. .set('@comp', resolve('src/components'))
  34. .set('@views', resolve('src/views'))
  35. .set('@layout', resolve('src/layout'))
  36. .set('@static', resolve('src/static'))
  37. },
  38. css: {
  39. loaderOptions: {
  40. less: {
  41. modifyVars: {
  42. /* less 变量覆盖,用于自定义 ant design 主题 */
  43. /*
  44. 'primary-color': '#F5222D',
  45. 'link-color': '#F5222D',
  46. 'border-radius-base': '4px',
  47. */
  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://localhost:8080', //请求本地 需要jeecg-boot后台项目
  66. ws: false,
  67. changeOrigin: true
  68. },
  69. }
  70. },
  71. lintOnSave: undefined
  72. }