craco.config.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. devServer: (devServerConfig, { env, paths, proxy, allowedHost }) => {
  18. devServerConfig.proxy={
  19. '/security-center':'http://192.168.2.237:8871',
  20. '/daqe-center':'http://192.168.2.237:8871',
  21. pathRewrite: {'/center' : ''},
  22. changeOrigin: true
  23. };
  24. return devServerConfig;
  25. },
  26. webpack:{
  27. alias:{
  28. '@':resolve('src'),
  29. '@common':resolve('src/common'),
  30. '@components':resolve('src/components'),
  31. '@utils':resolve('src/utils'),
  32. '@images':resolve('src/images'),
  33. '@store':resolve('src/store'),
  34. '@actions':resolve('src/store/actions'),
  35. '@reducers':resolve('src/store/reducers'),
  36. '@api':resolve('src/api'),
  37. /*'parchment': resolve('node_modules/parchment/src/parchment.ts'),
  38. 'quill': resolve('node_modules/quill/quill.js'),*/
  39. }
  40. },
  41. plugins: [
  42. {
  43. plugin: CracoLessPlugin,
  44. options: {
  45. styleLoaderOptions:{},
  46. cssLoaderOptions:{},
  47. lessLoaderOptions: {
  48. lessOptions: {
  49. modifyVars: {
  50. '@primary-color': '#1690FF',
  51. '@theme-bg-color':'#fff',
  52. '@link-color': '#1690FF', // 链接色
  53. '@success-color': '#52c41a', // 成功色
  54. '@warning-color': '#FE9748', // 警告色
  55. '@error-color': '#FF4D4D', // 错误色
  56. '@font-size-base': '14px', // 主字号
  57. '@heading-color': '#333', // 标题色
  58. '@text-color': '#333', // 主文本色
  59. '@text-color-secondary': '#666', // 次文本色
  60. '@disabled-color': '#999', // 失效色
  61. '@border-radius-base': '2px', // 组件/浮层圆角
  62. '@border-color-base': '#DEE2E9', // 边框色
  63. '@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)',
  64. },
  65. javascriptEnabled: true,
  66. },
  67. },
  68. },
  69. },
  70. ],
  71. };