Skip to content

Commit

Permalink
fix: avoid the "from" argument must be of type string error (#908)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Mar 11, 2019
1 parent bc16c3d commit e5dfd23
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import path from 'path';

import cc from 'camelcase';
import loaderUtils from 'loader-utils';
import normalizePath from 'normalize-path';

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

Expand Down Expand Up @@ -71,9 +72,9 @@ function getLocalIdent(loaderContext, localIdentName, localName, options) {
options.context = loaderContext.rootContext;
}

const request = path
.relative(options.context, loaderContext.resourcePath)
.replace(/\\/g, '/');
const request = normalizePath(
path.relative(options.context || '', loaderContext.resourcePath)
);

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

0 comments on commit e5dfd23

Please sign in to comment.