craco.config.js 2.7 KB

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