暫無描述

config-overrides.js 839B

1234567891011121314151617181920212223242526272829303132333435
  1. const fs = require('fs');
  2. const path = require('path');
  3. const rootPath = fs.realpathSync(process.cwd());
  4. const srcPath = path.resolve(rootPath, )
  5. module.exports = function override(config, env) {
  6. config.resolve.extensions = ['.js', '.jsx', '.ts', '.tsx', '.less', '.json'];
  7. config.resolve.alias = {
  8. '@': srcPath,
  9. '@components': `${srcPath}srcPath/components`,
  10. };
  11. config.module.rules.push({
  12. test: /\.less$/,
  13. use: [
  14. 'style-loader',
  15. {
  16. loader: 'css-loader',// translates CSS into CommonJS
  17. options: {
  18. modules: {
  19. localIdentName: '[name]__[local]___[hash:base64:5]',
  20. },
  21. }
  22. },
  23. 'postcss-loader',
  24. {
  25. loader: 'less-loader',
  26. options: {
  27. javascriptEnabled: true,
  28. },
  29. }],
  30. exclude: /node_modules|antd\.less/,
  31. });
  32. return config;
  33. }