React ^ 16.8.6 add stylus & less; configure [email protected]

Time:2019-10-21

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)

React ^ 16.8.6 add stylus & less; configure alias@

3. Modify webpack.config.js. The content in the red box is not updated.

React ^ 16.8.6 add stylus & less; configure alias@

React ^ 16.8.6 add stylus & less; configure alias@

React ^ 16.8.6 add stylus & less; configure alias@

4. Restart yarn start and finish

React ^ 16.8.6 add stylus & less; configure alias@

Configure [email protected]

The operation is as follows, and the restart takes effect.
React ^ 16.8.6 add stylus & less; configure alias@

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.

React ^ 16.8.6 add stylus & less; configure alias@