Closed Altamill closed 4 years ago
config-overrides 是什么东西?
https://ant.design/docs/react/use-with-create-react-app-cn 此链接中的高级配置项下有详细说明这个文件的用处,个人理解应该是用来按需加载样式用的。
- const darkTheme = require("@ant-design/dark-theme");
+ const darkTheme = require("@ant-design/dark-theme").default;
Try it.
或者 console.log(darkTheme) 看看是啥。
console.log(darkTheme)是@ant-design dark-theme 目录下 inde.js 文件中的样式
const darkTheme = require("@ant-design/dark-theme").default; 更改之后只有部分样式被覆盖,字体以及按钮等其他样式还是原来的
@ant-design/dark-theme
还不完善,欢迎给我们 PR。
`const { override, fixBabelImports, addLessLoader, } = require("customize-cra");
const darkTheme = require("@ant-design/dark-theme");
process.env.GENERATE_SOURCEMAP = "false"; //打包时去除map文件 module.exports = override( fixBabelImports("import", { libraryName: "antd", libraryDirectory: "es", style: true // change importing css to less }), addLessLoader({ javascriptEnabled: true, modifyVars: darkTheme }) );`