From 437c48e9d925a3ef90a66be5e78fc1d66b28f48e Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Mon, 27 Dec 2021 10:46:33 +0800 Subject: [PATCH] fix(@kkt/stylus-modules): fix rules options errors #198. --- packages/less-modules/src/index.ts | 1 + packages/stylus-modules/src/index.ts | 10 +--------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/less-modules/src/index.ts b/packages/less-modules/src/index.ts index 311df42a..58cd2b3b 100644 --- a/packages/less-modules/src/index.ts +++ b/packages/less-modules/src/index.ts @@ -74,6 +74,7 @@ const createLessModule = (lessLoaderOptions = {} as LessLoaderOptions) => { modules: { mode: 'local', // @ts-ignore + //πŸ’₯πŸ”₯πŸš¨πŸšΈπŸš«β›”οΈπŸ”„ Upgrade `@types/react-dev-utils` getLocalIdent: getCSSModuleLocalIdent, }, }, diff --git a/packages/stylus-modules/src/index.ts b/packages/stylus-modules/src/index.ts index ff603f21..97b46023 100644 --- a/packages/stylus-modules/src/index.ts +++ b/packages/stylus-modules/src/index.ts @@ -157,15 +157,7 @@ const createLessModule = (stylusLoaderOptions = {} as StylusLoaderOptions) => { // Exclude all less files (including module files) from file-loader conf.module.rules = conf.module.rules.map((rule) => { if (typeof rule === 'object' && rule.oneOf) { - rule.oneOf = rule.oneOf.map((item) => { - if (typeof item.loader === 'string' && /(file-loader)/.test(item.loader)) { - if (Array.isArray(item.exclude)) { - item.exclude.push(sassRegex); - } - } - return item; - }); - rule.oneOf = loaders.concat(rule.oneOf); + loaders.forEach((item) => rule.oneOf.splice(rule.oneOf.length - 1, 0, item)); } return rule; });