vue.config.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. /*
  13. pages: {
  14. index: {
  15. entry: 'src/main.js',
  16. chunks: ['chunk-vendors', 'chunk-common', 'index']
  17. }
  18. },
  19. */
  20. configureWebpack: {
  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. .set('@static', resolve('src/static'))
  31. },
  32. css: {
  33. loaderOptions: {
  34. less: {
  35. modifyVars: {
  36. /* less 变量覆盖,用于自定义 ant design 主题 */
  37. /*
  38. 'primary-color': '#F5222D',
  39. 'link-color': '#F5222D',
  40. 'border-radius-base': '4px',
  41. */
  42. },
  43. javascriptEnabled: true,
  44. }
  45. }
  46. },
  47. devServer: {
  48. proxy: {
  49. '/api': {
  50. target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro',
  51. ws: false,
  52. changeOrigin: true
  53. },
  54. '/gateway': {
  55. target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro',
  56. changeOrigin: true,
  57. pathRewrite: {
  58. '^/gateway': '/api'
  59. }
  60. }
  61. }
  62. }
  63. }