From 7095a7ca7d985d5447aed80cf3e41a4f8c19b954 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Wed, 24 Mar 2021 14:39:04 +0300 Subject: [PATCH] fix: crash with thread-loader (#1281) --- src/utils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index 7bc36537..5cbd52db 100644 --- a/src/utils.js +++ b/src/utils.js @@ -71,7 +71,7 @@ function defaultGetLocalIdent( let relativeMatchResource = ""; // eslint-disable-next-line no-underscore-dangle - if (loaderContext._module.matchResource) { + if (loaderContext._module && loaderContext._module.matchResource) { relativeMatchResource = `${normalizePath( // eslint-disable-next-line no-underscore-dangle path.relative(options.context, loaderContext._module.matchResource) @@ -138,7 +138,8 @@ const icssRegExp = /\.icss\.\w+$/i; function getModulesOptions(rawOptions, loaderContext) { const resourcePath = // eslint-disable-next-line no-underscore-dangle - loaderContext._module.matchResource || loaderContext.resourcePath; + (loaderContext._module && loaderContext._module.matchResource) || + loaderContext.resourcePath; let isIcss;