craco.config.js 2.8 KB

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