Skip to content

Commit 7095a7c

Browse files
authoredMar 24, 2021
fix: crash with thread-loader (#1281)
1 parent e194e6b commit 7095a7c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎src/utils.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function defaultGetLocalIdent(
7171
let relativeMatchResource = "";
7272

7373
// eslint-disable-next-line no-underscore-dangle
74-
if (loaderContext._module.matchResource) {
74+
if (loaderContext._module && loaderContext._module.matchResource) {
7575
relativeMatchResource = `${normalizePath(
7676
// eslint-disable-next-line no-underscore-dangle
7777
path.relative(options.context, loaderContext._module.matchResource)
@@ -138,7 +138,8 @@ const icssRegExp = /\.icss\.\w+$/i;
138138
function getModulesOptions(rawOptions, loaderContext) {
139139
const resourcePath =
140140
// eslint-disable-next-line no-underscore-dangle
141-
loaderContext._module.matchResource || loaderContext.resourcePath;
141+
(loaderContext._module && loaderContext._module.matchResource) ||
142+
loaderContext.resourcePath;
142143

143144
let isIcss;
144145

0 commit comments

Comments
 (0)