const path = require('path');

module.exports = {
  module: {
    rules: [
      {
        oneOf: [
          {
            test: /src[\\/]theme\.less$/,
            use: [
              {
                loader: `${path.resolve(
                  __dirname,
                  '../../src/less-vars-to-js-loader.js',
                )}?path=./src`,
              },
            ],
          },
          {
            test: /\.less$/,
            use: [
              'style-loader',
              'css-loader',
              {
                loader: 'less-loader?modules',
                options: {
                  javascriptEnabled: true,
                },
              },
            ],
            include: path.resolve(__dirname, '../../src'),
          },
        ],
      },
      {
        test: /\.(eot|svg|ttf|woff(2)?)(\?v=\d+\.\d+\.\d+)?/,
        use: [
          {
            loader: require.resolve('url-loader'),
          },
        ],
      },
    ],
  },
};
