craco-antd | A craco plugin to use Ant Design with create-react-app
kandi X-RAY | craco-antd Summary
kandi X-RAY | craco-antd Summary
A craco plugin to use Ant Design with create-react-app
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of craco-antd
craco-antd Key Features
craco-antd Examples and Code Snippets
Community Discussions
Trending Discussions on craco-antd
QUESTION
I'm having an issue importing a component from one React project into another. The problems seems very basic but I'm having a really hard time figuring out where the problem is and what is the exact craco configuration to achieve my goal.
Exporting project
I'm exporting App
, which is a functional React component.
src/index.js
...ANSWER
Answered 2021-Mar-29 at 21:20So after days fiddling with the webpack configurations I came across this life saver article. The thing I didn't try was the first thing the article says: "Output a single bundle instead of chunks". The lines that did the trick included changing the optimization webpack configuration:
QUESTION
I have to be able to change ant design variables at runtime (not via theme less files). I've found plenty of examples of this using customize-cra and react-app-rewire-less, but none seem to work with craco. I have to use craco because I'm also using tailwindcss in this project.
What I've tried:
- antd-theme-webpack-plugin: I have access to
window.less.modifyVars
, but it seems to do nothing (calling it throws no errors, but the antd colors don't change); - antd-theme-switcher: Very similar to the above,
window.less.modifyVars
seems to have no effect; - antd-theme: I could not figure out how to add the
AntdThemePlugin.loader
incraco.config.js
, and I'm not sure that is the problem, but I could not make it work.
This is the current state of my craco.config.js
:
ANSWER
Answered 2021-Mar-16 at 17:57As of today I got it working. The second solution (antd-theme-switcher) actually worked as intended. My error is that I was adding the antd default variables in my main less file, but for this to work I had to add the color.less file in my public folder (as the second step in antd-theme-switcher says), so that window.less.modifyVars
has a less file to work in.
This seem to be not the most performatic approach though, and I'm going to bail from using antd in my project as soon as I can, as there seems to be no optimal solution for changing variables at runtime with this specific setup.
QUESTION
EDIT: To comply with Stackoverflow guidelines and makes thing easy for all of us, I have submitted a small reproducible example that reproduces my bug:
https://github.com/shackra/stackoverflow-alias-bug
EDIT 2: if this is of help, I'm using asdf
version v0.8.0-c6145d0
to manage my nodejs
installation:
ANSWER
Answered 2020-Dec-01 at 20:20I see that craco.config.js format needs correction.
Change
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install craco-antd
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page