Execute npm run eject to expose the module
Install npm i less less-loader -D
1 .Open webpack.config.js of react app
//Add
< div> test: lessModuleRegex,
< div> const sassRegex = /\.(scss|sass)$/;
//Add
const sassRegex = /\.(scss|sass)$/;
const sassMo duleRegex = /\.module\.(scss|sass)$/;
const lessRegex = /\.less$/;
const lessModuleRegex = /\.module\.less $/;
2. Add in about 467 lines
{
test: lessRegex,
exclude: sassModuleRegex,
use : getStyleLoaders(
{
importLoaders: 2,
sourceMap: isEnvProduction && shouldUseSourceMap,
},
‘less-loader’
),
// Don’t consider CSS imports dead code even if the
// containing package claims to have no side effects.
// Remove this when webpack adds a warning or an error for this.
// See https://github .com/webpack/webpack/issues/6571
sideEffects: true,
},
// Adds support for CSS Modules, but using SASS
p>
// using the extension .module.scss or .module.sass
{
test: lessModuleRegex,
use: getStyleLoaders(< /p>
{
importLoaders: 2,
sourceMap: isEnvProduction && shouldUseSourceMap,
modules: true,
getLocalIdent : getCSSModuleLocalIdent,
},
‘less-loader’
),
},
# Must be on file-loader
At this time, you will find that npm start will report an error
Delete node_modules
Reinstall npm instal
Re-npm tsatrt
Success
Applause
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 573 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC