const fs = require('fs');
const path = require('path');

const rootPath = fs.realpathSync(process.cwd());
const srcPath = path.resolve(rootPath, )

module.exports = function override(config, env) {
  config.resolve.extensions = ['.js', '.jsx', '.ts', '.tsx', '.less', '.json'];
  config.resolve.alias = {
    '@': srcPath,
    '@components': `${srcPath}/components`,
  };
  config.module.rules.push({
    test: /\.less$/,
    use: [
    'style-loader', 
    {
      loader: 'css-loader',// translates CSS into CommonJS
      options: {
        modules: {
          localIdentName: '[name]__[local]___[hash:base64:5]',
        },
      }
    },
    'postcss-loader',
    {
      loader: 'less-loader',
      options: {
        javascriptEnabled: true,
      },
    }],
    exclude: /node_modules|antd\.less/,
  });
  return config;
}