From 5cba1c7c31357ff624a819534cc31b036b49efbd Mon Sep 17 00:00:00 2001 From: zougt Date: Wed, 27 Oct 2021 10:50:12 +0800 Subject: [PATCH] fix(): lack of deps and error when multipleScopeVars is [] --- package.json | 2 +- src/utils.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index dc15dc0..d8ecf44 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@zougt/some-loader-utils", - "version": "1.3.1", + "version": "1.3.2", "description": "implementation for less-loader or sass-loader. Compiles Less or sass to CSS.", "license": "MIT", "repository": "GitOfZGT/some-loader-utils", diff --git a/src/utils.js b/src/utils.js index 7e16383..0d98d6c 100644 --- a/src/utils.js +++ b/src/utils.js @@ -7,7 +7,7 @@ import postcssAddScopeName from './postcss-addScopeName'; const getAllStyleVarFiles = (loaderContext, options) => { const styleVarFiles = options.multipleScopeVars; let allStyleVarFiles = [{ scopeName: '', path: '' }]; - if (Array.isArray(styleVarFiles)) { + if (Array.isArray(styleVarFiles) && styleVarFiles.length) { if (styleVarFiles.length === 1) { allStyleVarFiles = styleVarFiles.map((item) => { if (Array.isArray(item.path)) { @@ -143,7 +143,10 @@ const getScopeProcessResult = ( } }); }); - + preprocessResult.deps = [ + ...preprocessResult.deps, + ...(cssResults[0].deps || []), + ]; /** * 用cssResults的第一个css内容进入postcss */