const CracoLessPlugin = require("craco-less");
const CracoCesiumPlugin = require("craco-cesium");

const path = require("path");

module.exports = {
  webpack: {
    alias: {
      ["@"]: path.resolve(__dirname, "src"),
    },
  },
  plugins: [
    {
      plugin: CracoLessPlugin,
      options: {
        lessLoaderOptions: {
          lessOptions: {
            modifyVars: { "@primary-color": "#016bbb" },
            javascriptEnabled: true,
          },
        },
      },
    },
    {
      plugin: CracoLessPlugin,
      options: {
        modifyLessRule: function (lessRule, _context) {
          lessRule.test = /\.(module)\.(less)$/;
          lessRule.exclude = /node_modules/;
          return lessRule;
        },
        cssLoaderOptions: {
          modules: { localIdentName: "[local]_[hash:base64:5]" },
        },
      },
    },
    {
      plugin: CracoCesiumPlugin(),
    },
  ],
};
