请问一下 , 使用craco配置webpack style-resources-loader ,想全局导入公用的less ,不起作用,代码如下, 是配置问题吗?
module.exports = {
webpack: {
module: {
rules: [
{
test: /\.less$/,
use: [
"style-loader",
"less-loader",
"less-loader",
{
loader: "style-resources-loader",
options: {
patterns: path.resolve(
__dirname,
"./src/style/commonStyle.less"
),
injector: "append",
},
},
],
},
],
},
plugins: [
new SimpleProgressWebpackPlugin(),
// new BundleAnalyzerPlugin()
],
},
babel: {
plugins: [
[
"import",
{
libraryName: "antd",
libraryDirectory: "es",
style: true,
},
],
],
},
plugins: [
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: { "@primary-color": "red" },
javascriptEnabled: true,
},
},
},
},
],
};