craco.config.js 2.8 KB

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