craco.config.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*******覆盖create-react-app默认配置******/
  2. const path = require('path');
  3. const resolve = dir => path.resolve(__dirname,dir);
  4. const CracoLessPlugin = require('craco-less');
  5. module.exports = {
  6. /*devServer:{
  7. port: 8080,
  8. proxy: {
  9. '/api': {
  10. target: 'http://192.168.2.232:8871/',
  11. changeOrigin: true,
  12. secure: false,
  13. xfwd: false,
  14. }
  15. }
  16. },*/
  17. webpack:{
  18. alias:{
  19. '@':resolve('src'),
  20. '@common':resolve('src/common'),
  21. '@components':resolve('src/components'),
  22. '@utils':resolve('src/utils'),
  23. '@images':resolve('src/images'),
  24. '@store':resolve('src/store'),
  25. '@actions':resolve('src/actions'),
  26. '@reducers':resolve('src/reducers'),
  27. '@api':resolve('src/api'),
  28. }
  29. },
  30. plugins: [
  31. {
  32. plugin: CracoLessPlugin,
  33. options: {
  34. styleLoaderOptions:{},
  35. cssLoaderOptions:{},
  36. lessLoaderOptions: {
  37. lessOptions: {
  38. modifyVars: {
  39. '@primary-color': '#1690FF',
  40. '@theme-bg-color':'#fff',
  41. '@link-color': '#1690FF', // 链接色
  42. '@success-color': '#52c41a', // 成功色
  43. '@warning-color': '#faad14', // 警告色
  44. '@error-color': '#f5222d', // 错误色
  45. '@font-size-base': '14px', // 主字号
  46. '@heading-color': '#333', // 标题色
  47. '@text-color': '#333', // 主文本色
  48. '@text-color-secondary': '#666', // 次文本色
  49. '@disabled-color': '#999', // 失效色
  50. '@border-radius-base': '2px', // 组件/浮层圆角
  51. '@border-color-base': '#D8D8D8', // 边框色
  52. '@box-shadow-base':'0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08),0 9px 28px 8px rgba(0, 0, 0, 0.05)',
  53. },
  54. javascriptEnabled: true,
  55. },
  56. },
  57. },
  58. },
  59. ],
  60. };