Premise: for projects created with yarn create react app, yarn add antd introduces antd
1. yarn run eject
2. yarn add stylus stylus-loader
If less is required, replace all stylus in this article with less, or add less to make stylus and less effective at the same time.
At this time, the error may be reported as follows. Delete the node modules, perform yarn to reinstall all the packages, restart and pass.
(I don’t know why the error is reported)
3. Modify webpack.config.js. The content in the red box is not updated.
4. Restart yarn start and finish
Configure [email protected]
The operation is as follows, and the restart takes effect.
Add a simple way to configure stylus. After the plug-in is installed, add the code in the thick wireframe in the config file as shown in the figure below.