Skip to content

Commit

Permalink
fix(rax-compat): fix less style handle when inlineStyle enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
linbudu599 committed Aug 10, 2023
1 parent 32dfaac commit 8f23a54
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/plugin-rax-compat/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,18 @@ const styleSheetLoaderForClient = (config, transformCssModule, inlineStyleFiler:

// Find and replace the less rule
if (rule.test && rule.test instanceof RegExp && rule.test.source.indexOf('.less') > -1) {
rule.test = transformCssModule ? /(\.module|global)\.less$/i : /(\.global)\.less$/i;
rule.test = (id: string) => {
const inlineStyleDisabled = typeof inlineStyleFiler === 'function'
? inlineStyleFiler(id) === false
: false;

const matched =
(transformCssModule ? /(\.module|global)\.less$/i : /(\.global)\.less$/i).test(id) ||
inlineStyleDisabled;

return matched;
};

rules[i] = {
test: /\.less$/i,
oneOf: [
Expand Down

0 comments on commit 8f23a54

Please sign in to comment.