vue.config.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. 'primary-color': '#F5222D',
  31. 'link-color': '#F5222D',
  32. 'border-radius-base': '4px',
  33. },
  34. javascriptEnabled: true,
  35. }
  36. }
  37. },
  38. devServer: {
  39. proxy: {
  40. '/api': {
  41. target: 'https://www.easy-mock.com/mock/5b7bce071f130e5b7fe8cd7d/antd-pro',
  42. ws: true,
  43. changeOrigin: true
  44. },
  45. '/gateway': {
  46. target: 'https://www.easy-mock.com/mock/5b7bce071f130e5b7fe8cd7d/antd-pro',
  47. changeOrigin: true,
  48. pathRewrite: {
  49. '^/gateway': '/api'
  50. }
  51. }
  52. }
  53. }
  54. }