craco.config.js 2.6 KB

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