From 68e04dc03d99780891d06ff3873deac00c5127d8 Mon Sep 17 00:00:00 2001 From: dr2009 Date: Tue, 21 Dec 2021 09:58:37 +0800 Subject: [PATCH] fix: icss mode not work for less global --- lib/craco-less.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/craco-less.js b/lib/craco-less.js index 3206d30..5d98cb0 100644 --- a/lib/craco-less.js +++ b/lib/craco-less.js @@ -56,11 +56,13 @@ const overrideWebpackConfig = ({ context, webpackConfig, pluginOptions }) => { }, }); } else if (rule.loader.includes(`${pathSep}css-loader${pathSep}`)) { + const isModule = overrideRule.test === lessModuleRegex; lessRule.use.push({ loader: rule.loader, options: { ...rule.options, ...(pluginOptions.cssLoaderOptions || {}), + ...(isModule ? {} : { modules: { mode: "global" } }), }, }); } else if (rule.loader.includes(`${pathSep}postcss-loader${pathSep}`)) {