Before configuring create-react-app, it is important to know that the project created by create-react-app does not expose configuration information by default. All configuration information can be found in node_modules/react-scripts

1. The installation of flexible

npm i lib-flexible --save
Copy the code

2. Install sass-loader node-sass

npm i sass-loader node-sass --save-dev
Copy the code

3. Install postcss – px2rem

 npm i postcss-px2rem --save
Copy the code

4. In node_modules/config/webpack. Config. Js and make the following configuration:

Const px2rem = require('postcss-px2rem'); px2rem({ remUnit: 75 })Copy the code

5. Introduce lib-flexible, introduce lib-flexible in the project entry file index.js

import 'lib-flexible'
Copy the code

6. Restart the project to complete the configuration