craco.config.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const path = require('path');
  2. // const { ESLINT_MODES } = require("@craco/craco");
  3. const webpack = require("webpack");
  4. const WebpackBar = require('webpackbar');
  5. const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin');
  6. const darkTheme = require('@ant-design/dark-theme').default;
  7. const CracoAntdPlugin = require('craco-antd');
  8. module.exports = {
  9. eslint: {
  10. enable: false,
  11. // mode: ESLINT_MODES.file
  12. },
  13. plugins: [
  14. {
  15. plugin: CracoAntdPlugin,
  16. options: {
  17. customizeTheme: darkTheme,
  18. },
  19. },
  20. ],
  21. webpack: {
  22. configure: {
  23. resolve: {
  24. extensions: ['.js', '.jsx', '.json', '.png', '.webp', '.jpg'],
  25. }
  26. },
  27. alias: {
  28. "@styles": path.resolve(__dirname, "src/styles"),
  29. "@images": path.resolve(__dirname, "src/images"),
  30. "@image": path.resolve(__dirname, "src/images"),
  31. "@views": path.resolve(__dirname, "src/views"),
  32. "@": path.resolve(__dirname, "src"),
  33. },
  34. plugins: [
  35. new webpack.ProgressPlugin(),
  36. new WebpackBar(),
  37. new AntdDayjsWebpackPlugin(),
  38. ],
  39. },
  40. jest: {
  41. configure: {
  42. moduleNameMapper: {
  43. "@": "<rootDir>/src/$1",
  44. "@styles": "<rootDir>/src/styles/$1",
  45. "@images": "<rootDir>/src/images/$1",
  46. "@image": "<rootDir>/src/images/$1",
  47. "@views": "<rootDir>/src/views/$1",
  48. }
  49. }
  50. }
  51. }