React,ant design,不能改变默认的less变量

问题描述

我正在尝试更改和主题,我按照说明 here 并在 creat-react-app 中提出了以下配置:
craco.config.js

const CracoLessplugin = require("craco-less");
const theme = require("./theme");

module.exports = {
  plugins: [
    {
      plugin: CracoLessplugin,options: {
        lessLoaderOptions: {
          lessOptions: {
            modifyVars: theme,javascriptEnabled: true
          }
        }
      }
    }
  ]
};

这是我的 theme.js 文件

module.exports = {
  "@menu-item-height": "100px","@menu-item-padding": "40px 20px","@primary-color": "red","@menu-item-color": "green","@menu-bg": "blue"
};

正如文档所建议的,我的 app.less 文件

@import "~antd/dist/antd.less";

上述解决方案似乎工作正常,但不知何故,我无法在具有以下内容的任何模块中更改 @menu-item-height@menu-item-padding 之类的内容@primary-color 工作正常):

import {Menu} from 'antd'
...
<Menu>
    <Menu.Item>yellow</Menu.Item>
</Menu>

那么任何人都可以提出更改建议或指出我犯的错误吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)