vue.config.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. const path = require('path')
  2. function resolve (dir) {
  3. return path.join(__dirname, dir)
  4. }
  5. // vue.config.js
  6. module.exports = {
  7. pages: {
  8. index: {
  9. entry: 'src/main.js',
  10. chunks: ['chunk-vendors', 'chunk-common', 'index']
  11. }
  12. },
  13. configureWebpack: {
  14. },
  15. chainWebpack: (config) => {
  16. config.resolve.alias
  17. .set('@$', resolve('src'))
  18. .set('@api', resolve('src/api'))
  19. .set('@assets', resolve('src/assets'))
  20. .set('@comp', resolve('src/components'))
  21. .set('@views', resolve('src/views'))
  22. .set('@layout', resolve('src/layout'))
  23. .set('@static', resolve('src/static'))
  24. },
  25. css: {
  26. loaderOptions: {
  27. less: {
  28. modifyVars: {
  29. /* less 变量覆盖,用于自定义 ant design 主题 */
  30. /*
  31. 'primary-color': '#F5222D',
  32. 'link-color': '#F5222D',
  33. 'border-radius-base': '4px',
  34. */
  35. },
  36. javascriptEnabled: true,
  37. }
  38. }
  39. },
  40. devServer: {
  41. disableHostCheck: true
  42. // proxy: {
  43. // '/api': {
  44. // target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro',
  45. // ws: false,
  46. // changeOrigin: true
  47. // },
  48. // '/gateway': {
  49. // target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro',
  50. // changeOrigin: true,
  51. // pathRewrite: {
  52. // '^/gateway': '/api'
  53. // }
  54. // }
  55. // }
  56. }
  57. }