vue.config.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. const path = require('path')
  2. const webpack = require('webpack')
  3. function resolve (dir) {
  4. return path.join(__dirname, dir)
  5. }
  6. // vue.config.js
  7. module.exports = {
  8. /*
  9. Vue-cli3:
  10. Crashed when using Webpack `import()` #2463
  11. https://github.com/vuejs/vue-cli/issues/2463
  12. */
  13. /*
  14. pages: {
  15. index: {
  16. entry: 'src/main.js',
  17. chunks: ['chunk-vendors', 'chunk-common', 'index']
  18. }
  19. },
  20. */
  21. configureWebpack: {
  22. plugins: [
  23. // Ignore all locale files of moment.js
  24. new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
  25. ]
  26. },
  27. chainWebpack: (config) => {
  28. config.resolve.alias
  29. .set('@$', resolve('src'))
  30. .set('@api', resolve('src/api'))
  31. .set('@assets', resolve('src/assets'))
  32. .set('@comp', resolve('src/components'))
  33. .set('@views', resolve('src/views'))
  34. .set('@layout', resolve('src/layout'))
  35. .set('@static', resolve('src/static'))
  36. },
  37. css: {
  38. loaderOptions: {
  39. less: {
  40. modifyVars: {
  41. /* less 变量覆盖,用于自定义 ant design 主题 */
  42. /*
  43. 'primary-color': '#F5222D',
  44. 'link-color': '#F5222D',
  45. 'border-radius-base': '4px',
  46. */
  47. },
  48. javascriptEnabled: true,
  49. }
  50. }
  51. },
  52. devServer: {
  53. proxy: {
  54. '/api': {
  55. // target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro',
  56. target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro',
  57. ws: false,
  58. changeOrigin: true
  59. },
  60. '/gateway': {
  61. target: 'https://www.easy-mock.com/mock/5b7bce071f130e5b7fe8cd7d/antd-pro',
  62. ws: false,
  63. changeOrigin: true,
  64. pathRewrite: {
  65. '^/gateway': '/api'
  66. }
  67. }
  68. }
  69. },
  70. lintOnSave: undefined
  71. }