diff --git a/package.json b/package.json index 76428de..dc15dc0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@zougt/some-loader-utils", - "version": "1.3.0", + "version": "1.3.1", "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 8014841..7e16383 100644 --- a/src/utils.js +++ b/src/utils.js @@ -10,18 +10,6 @@ const getAllStyleVarFiles = (loaderContext, options) => { if (Array.isArray(styleVarFiles)) { if (styleVarFiles.length === 1) { allStyleVarFiles = styleVarFiles.map((item) => { - if ( - !item.path || - typeof item.path !== 'string' || - !fs.existsSync(item.path) - ) { - loaderContext.emitError( - new Error( - `Not found path: ${item.path} in multipleScopeVars` - ) - ); - return { scopeName: '', path: '' }; - } if (Array.isArray(item.path)) { const exist = item.path.every((pathstr) => { const exists = pathstr && fs.existsSync(pathstr); @@ -37,6 +25,17 @@ const getAllStyleVarFiles = (loaderContext, options) => { if (!exist) { return { scopeName: '', path: '' }; } + } else if ( + !item.path || + typeof item.path !== 'string' || + !fs.existsSync(item.path) + ) { + loaderContext.emitError( + new Error( + `Not found path: ${item.path} in multipleScopeVars` + ) + ); + return { scopeName: '', path: '' }; } return { ...item, scopeName: '' }; });