Skip to content

Commit e5dfd23

Browse files
fix: avoid the "from" argument must be of type string error (#908)
1 parent bc16c3d commit e5dfd23

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/utils.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import path from 'path';
66

77
import cc from 'camelcase';
88
import loaderUtils from 'loader-utils';
9+
import normalizePath from 'normalize-path';
910

1011
/* eslint-disable line-comment-position */
1112

@@ -71,9 +72,9 @@ function getLocalIdent(loaderContext, localIdentName, localName, options) {
7172
options.context = loaderContext.rootContext;
7273
}
7374

74-
const request = path
75-
.relative(options.context, loaderContext.resourcePath)
76-
.replace(/\\/g, '/');
75+
const request = normalizePath(
76+
path.relative(options.context || '', loaderContext.resourcePath)
77+
);
7778

7879
// eslint-disable-next-line no-param-reassign
7980
options.content = `${options.hashPrefix + request}+${unescape(localName)}`;

0 commit comments

Comments
 (0)